Android: don't call QtLoader.finish() on null activity/service
Task-number: QTBUG-115016 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> (cherry picked from commit 84f0b483b5befb2fef070b5c05c17e1fcd7dac1d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c27163cd7d
commit
b9f5b892d4
@ -44,6 +44,10 @@ class QtActivityLoader extends QtLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showErrorDialog() {
|
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();
|
Resources resources = m_activity.getResources();
|
||||||
String packageName = m_activity.getPackageName();
|
String packageName = m_activity.getPackageName();
|
||||||
AlertDialog errorDialog = new AlertDialog.Builder(m_activity).create();
|
AlertDialog errorDialog = new AlertDialog.Builder(m_activity).create();
|
||||||
@ -57,6 +61,10 @@ class QtActivityLoader extends QtLoader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void finish() {
|
protected void finish() {
|
||||||
|
if (m_activity == null) {
|
||||||
|
Log.w(QtTAG, "finish() called when activity object is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
showErrorDialog();
|
showErrorDialog();
|
||||||
m_activity.finish();
|
m_activity.finish();
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,10 @@ class QtServiceLoader extends QtLoader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void finish() {
|
protected void finish() {
|
||||||
|
if (m_service != null)
|
||||||
m_service.stopSelf();
|
m_service.stopSelf();
|
||||||
|
else
|
||||||
|
Log.w(QtTAG, "finish() called when service object is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user