Skip to content

Commit

Permalink
Fix #1641
Browse files Browse the repository at this point in the history
  • Loading branch information
Dallas62 committed Sep 14, 2020
1 parent 3d769ad commit c1880e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html

### Fixed

## [5.1.1] 2020-09-14

### Fixed

- (Android) Fatal Exception: java.lang.NullPointerException [#1641](https://github.com/zo0r/react-native-push-notification/issues/1641)

## [5.1.0] 2020-08-31

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ private RNPushNotificationAttributes(JSONObject jsonObject) {
tag = jsonObject.has(TAG) ? jsonObject.getString(TAG) : null;
repeatType = jsonObject.has(REPEAT_TYPE) ? jsonObject.getString(REPEAT_TYPE) : null;
repeatTime = jsonObject.has(REPEAT_TIME) ? jsonObject.getDouble(REPEAT_TIME) : 0.0;
when = jsonObject.has(WHEN) ? jsonObject.getDouble(WHEN) : null;
when = jsonObject.has(WHEN) ? jsonObject.getDouble(WHEN) : -1;
usesChronometer = jsonObject.has(USES_CHRONOMETER) ? jsonObject.getBoolean(USES_CHRONOMETER) : false;
timeoutAfter = jsonObject.has(TIMEOUT_AFTER) ? jsonObject.getDouble(TIMEOUT_AFTER) : null;
timeoutAfter = jsonObject.has(TIMEOUT_AFTER) ? jsonObject.getDouble(TIMEOUT_AFTER) : -1;
onlyAlertOnce = jsonObject.has(ONLY_ALERT_ONCE) ? jsonObject.getBoolean(ONLY_ALERT_ONCE) : false;
ongoing = jsonObject.has(ONGOING) ? jsonObject.getBoolean(ONGOING) : false;
allowWhileIdle = jsonObject.has(ALLOW_WHILE_IDLE) ? jsonObject.getBoolean(ALLOW_WHILE_IDLE) : false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,14 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB

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

if (timeoutAfter != null) {
if (timeoutAfter != null && timeoutAfter >= 0) {
notification.setTimeoutAfter(timeoutAfter);
}
}

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

if (when != null) {
if (when != null && when >= 0) {
notification.setWhen(when);
}

Expand Down

0 comments on commit c1880e7

Please sign in to comment.