From 2095dae95d16347965d8fb5af4db81761133935a Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 30 Nov 2021 17:00:02 +0100 Subject: [PATCH] Fix build with older Java < 7 --- .../org/retroshare/service/RetroShareServiceAndroid.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/rs_android/org/retroshare/service/RetroShareServiceAndroid.java b/libretroshare/src/rs_android/org/retroshare/service/RetroShareServiceAndroid.java index 72fb57c32..818f06348 100644 --- a/libretroshare/src/rs_android/org/retroshare/service/RetroShareServiceAndroid.java +++ b/libretroshare/src/rs_android/org/retroshare/service/RetroShareServiceAndroid.java @@ -29,7 +29,7 @@ import android.content.Context; import android.content.Intent; import android.util.Log; import android.app.ActivityManager; -import java.util.Objects; + public class RetroShareServiceAndroid extends Service { @@ -70,8 +70,11 @@ public class RetroShareServiceAndroid extends Service public static Context getServiceContext() { if(sServiceContext == null) + { Log.e(TAG, "getServiceContext() called before onCreate"); - return Objects.requireNonNull(sServiceContext); + throw new NullPointerException(); + } + return sServiceContext; } @Override