Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: Release 5.0.0
-
Component/s: Android
-
Labels:None
-
Environment:
SDK 3.5.0.GA, 3.5.1, 4.0.0.GA
-
Story Points:3
-
Sprint:2015 Sprint 18 SDK
Description
Creating a separate ticket for my comments on TIMOB-18098.
PR https://github.com/appcelerator/titanium_mobile/pull/6958
Our app crashes frequently when the it's woken from the background by the user tapping a push notification. We are using the http://iamyellow.net/post/40100981563/gcm-appcelerator-titanium-module GCM module.
06-30 14:06:51.234: W/System.err(19120): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
|
06-30 14:06:51.234: W/System.err(19120): at org.appcelerator.titanium.proxy.IntentProxy.putExtra(IntentProxy.java:198)
|
06-30 14:06:51.234: W/System.err(19120): at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
|
06-30 14:06:51.234: W/System.err(19120): at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:177)
|
06-30 14:06:51.234: W/System.err(19120): at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:299)
|
06-30 14:06:51.234: W/System.err(19120): at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:203)
|
06-30 14:06:51.234: W/System.err(19120): at android.os.Handler.dispatchMessage(Handler.java:98)
|
06-30 14:06:51.234: W/System.err(19120): at android.os.Looper.loop(Looper.java:145)
|
06-30 14:06:51.234: W/System.err(19120): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
|
If the app is open when the message arrives, it is received and handled fine. If the app is in the background, we see the above in the adb logs. I have tried with 3.5.0.GA, 3.5.1.GA, 4.0.0.GA, and a nightly I built myself (don't recall the date of that build, but post GA). Tested on both Android 5.0 and 4.2.2 devices.
I have found that a simple null value check in the putExtra() method resolves this issue.
@Kroll.method
|
public void putExtra(String key, Object value)
|
{
|
if (value == null) {
|
return;
|
}
|
...
|
https://github.com/appcelerator/titanium_mobile/pull/6958 (master)
https://github.com/appcelerator/titanium_mobile/pull/6957 (3_5_X)