Fix VoicemailChangePinActivity crash on dialog dismiss

The VoicemailChangePinActivity code would crash if the activity was torn
down before the async task finished. Fix was to check the activity state
before calling Dialog.dismiss().

Bug: 31068693
Change-Id: I0089f13ab8f0cc88b960b6733ba6176f77ce57fa
diff --git a/src/com/android/phone/settings/VoicemailChangePinActivity.java b/src/com/android/phone/settings/VoicemailChangePinActivity.java
index 74adb12..8027dc1 100644
--- a/src/com/android/phone/settings/VoicemailChangePinActivity.java
+++ b/src/com/android/phone/settings/VoicemailChangePinActivity.java
@@ -629,7 +629,12 @@
 
         private void sendResult(@ChangePinResult int result) {
             VvmLog.i(TAG, "Change PIN result: " + result);
-            mProgressDialog.dismiss();
+            if (mProgressDialog.isShowing() && !VoicemailChangePinActivity.this.isDestroyed() &&
+                    !VoicemailChangePinActivity.this.isFinishing()) {
+                mProgressDialog.dismiss();
+            } else {
+                VvmLog.i(TAG, "Dialog not visible, not dismissing");
+            }
             mHandler.obtainMessage(MESSAGE_HANDLE_RESULT, result, 0).sendToTarget();
             releaseNetwork();
         }