[manager] Fix null pointer (#55)

This commit is contained in:
双草酸酯 2021-02-03 03:47:59 +08:00 committed by GitHub
parent cd38c8dda8
commit aadf2f54b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 13 deletions

View File

@ -33,20 +33,23 @@ public class MainActivity extends BaseActivity {
super.onCreate(savedInstanceState);
// make sure the versions are consistent
Version managerVersion = new Version(BuildConfig.VERSION_NAME);
Version coreVersion = new Version(Constants.getXposedVersion());
String coreVersionStr = Constants.getXposedVersion();
if (!managerVersion.equals(coreVersion)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.outdated_manager)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
android.os.Process.killProcess(android.os.Process.myPid());
}
})
.setCancelable(false);
Dialog dlg = builder.create();
dlg.show();
if (coreVersionStr != null) {
Version managerVersion = new Version(BuildConfig.VERSION_NAME);
Version coreVersion = new Version(coreVersionStr);
if (!managerVersion.equals(coreVersion)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.outdated_manager)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
android.os.Process.killProcess(android.os.Process.myPid());
}
})
.setCancelable(false);
Dialog dlg = builder.create();
dlg.show();
}
}
binding = ActivityMainBinding.inflate(getLayoutInflater());