Fix build with older Java < 7

This commit is contained in:
Gioacchino Mazzurco 2021-11-30 17:00:02 +01:00
parent 856ce2ffb1
commit 2095dae95d
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051

View File

@ -29,7 +29,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.util.Log; import android.util.Log;
import android.app.ActivityManager; import android.app.ActivityManager;
import java.util.Objects;
public class RetroShareServiceAndroid extends Service public class RetroShareServiceAndroid extends Service
{ {
@ -70,8 +70,11 @@ public class RetroShareServiceAndroid extends Service
public static Context getServiceContext() public static Context getServiceContext()
{ {
if(sServiceContext == null) if(sServiceContext == null)
{
Log.e(TAG, "getServiceContext() called before onCreate"); Log.e(TAG, "getServiceContext() called before onCreate");
return Objects.requireNonNull(sServiceContext); throw new NullPointerException();
}
return sServiceContext;
} }
@Override @Override