Null pointer fix for StateMachine

Checks if StateMachine is null before calling callbacks.

Bug-Id: 26176787
Change-Id: I7ee92326e99e18a3b7045ccf098b52acfaff9a15
This commit is contained in:
Brad Ebinger
2015-12-14 08:46:49 -08:00
parent 0a3d3884c4
commit 355f11034d

View File

@@ -778,8 +778,11 @@ public class StateMachine {
*/
@Override
public final void handleMessage(Message msg) {
mSm.onPreHandleMessage(msg);
if (!mHasQuit) {
if (mSm != null) {
mSm.onPreHandleMessage(msg);
}
if (mDbg) mSm.log("handleMessage: E msg.what=" + msg.what);
/** Save the current message */
@@ -803,8 +806,11 @@ public class StateMachine {
// We need to check if mSm == null here as we could be quitting.
if (mDbg && mSm != null) mSm.log("handleMessage: X");
if (mSm != null) {
mSm.onPostHandleMessage(msg);
}
}
mSm.onPostHandleMessage(msg);
}
/**