Skip to content

Commit c08310b

Browse files
committed
Merge pull request #261 from ParsePlatform/wangmengyan.add_null_checking_for_push_raw_data
Add null checking for push raw data
2 parents a7f3f9b + f2a578b commit c08310b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Parse/src/main/java/com/parse/ParsePushBroadcastReceiver.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,15 @@ public void onReceive(Context context, Intent intent) {
136136
* An {@code Intent} containing the channel and data of the current push notification.
137137
*/
138138
protected void onPushReceive(Context context, Intent intent) {
139+
String pushDataStr = intent.getStringExtra(KEY_PUSH_DATA);
140+
if (pushDataStr == null) {
141+
PLog.e(TAG, "Can not get push data from intent.");
142+
return;
143+
}
144+
139145
JSONObject pushData = null;
140146
try {
141-
pushData = new JSONObject(intent.getStringExtra(KEY_PUSH_DATA));
147+
pushData = new JSONObject(pushDataStr);
142148
} catch (JSONException e) {
143149
PLog.e(TAG, "Unexpected JSONException when receiving push data: ", e);
144150
}

0 commit comments

Comments
 (0)