Android: don't call QtLoader.finish() on null activity/service
Task-number: QTBUG-115016 Pick-to: 6.7 Change-Id: Ia7cf066261bd0bb17d67423b5edf7b72ec33d577 Reviewed-by: Janne Juntunen <janne.juntunen@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>bb10
parent
fcc8b89ae0
commit
84f0b483b5
|
|
@ -44,6 +44,10 @@ class QtActivityLoader extends QtLoader {
|
|||
}
|
||||
|
||||
private void showErrorDialog() {
|
||||
if (m_activity == null) {
|
||||
Log.w(QtTAG, "cannot show the error dialog from a null activity object");
|
||||
return;
|
||||
}
|
||||
Resources resources = m_activity.getResources();
|
||||
String packageName = m_activity.getPackageName();
|
||||
AlertDialog errorDialog = new AlertDialog.Builder(m_activity).create();
|
||||
|
|
@ -57,6 +61,10 @@ class QtActivityLoader extends QtLoader {
|
|||
|
||||
@Override
|
||||
protected void finish() {
|
||||
if (m_activity == null) {
|
||||
Log.w(QtTAG, "finish() called when activity object is null");
|
||||
return;
|
||||
}
|
||||
showErrorDialog();
|
||||
m_activity.finish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,10 @@ class QtServiceLoader extends QtLoader {
|
|||
|
||||
@Override
|
||||
protected void finish() {
|
||||
m_service.stopSelf();
|
||||
if (m_service != null)
|
||||
m_service.stopSelf();
|
||||
else
|
||||
Log.w(QtTAG, "finish() called when service object is null");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue