Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit c1880e7

Browse files
committed
Fix #1641
1 parent 3d769ad commit c1880e7

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
1212

1313
### Fixed
1414

15+
## [5.1.1] 2020-09-14
16+
17+
### Fixed
18+
19+
- (Android) Fatal Exception: java.lang.NullPointerException [#1641](https://github.com/zo0r/react-native-push-notification/issues/1641)
1520

1621
## [5.1.0] 2020-08-31
1722

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationAttributes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ private RNPushNotificationAttributes(JSONObject jsonObject) {
165165
tag = jsonObject.has(TAG) ? jsonObject.getString(TAG) : null;
166166
repeatType = jsonObject.has(REPEAT_TYPE) ? jsonObject.getString(REPEAT_TYPE) : null;
167167
repeatTime = jsonObject.has(REPEAT_TIME) ? jsonObject.getDouble(REPEAT_TIME) : 0.0;
168-
when = jsonObject.has(WHEN) ? jsonObject.getDouble(WHEN) : null;
168+
when = jsonObject.has(WHEN) ? jsonObject.getDouble(WHEN) : -1;
169169
usesChronometer = jsonObject.has(USES_CHRONOMETER) ? jsonObject.getBoolean(USES_CHRONOMETER) : false;
170-
timeoutAfter = jsonObject.has(TIMEOUT_AFTER) ? jsonObject.getDouble(TIMEOUT_AFTER) : null;
170+
timeoutAfter = jsonObject.has(TIMEOUT_AFTER) ? jsonObject.getDouble(TIMEOUT_AFTER) : -1;
171171
onlyAlertOnce = jsonObject.has(ONLY_ALERT_ONCE) ? jsonObject.getBoolean(ONLY_ALERT_ONCE) : false;
172172
ongoing = jsonObject.has(ONGOING) ? jsonObject.getBoolean(ONGOING) : false;
173173
allowWhileIdle = jsonObject.has(ALLOW_WHILE_IDLE) ? jsonObject.getBoolean(ALLOW_WHILE_IDLE) : false;

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,14 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
501501

502502
Long timeoutAfter = (long) bundle.getDouble("timeoutAfter");
503503

504-
if (timeoutAfter != null) {
504+
if (timeoutAfter != null && timeoutAfter >= 0) {
505505
notification.setTimeoutAfter(timeoutAfter);
506506
}
507507
}
508508

509509
Long when = (long) bundle.getDouble("when");
510510

511-
if (when != null) {
511+
if (when != null && when >= 0) {
512512
notification.setWhen(when);
513513
}
514514

0 commit comments

Comments
 (0)