Skip to content

Commit

Permalink
Catch Android 7 specific error where primary color resolves to null p…
Browse files Browse the repository at this point in the history
…ointer when called from a Python context.
  • Loading branch information
rtibbles committed Jan 17, 2024
1 parent dfee793 commit bf43b56
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ public Builder(Context context, String channelId) {
super(context, channelId);
setSmallIcon(R.drawable.ic_stat_kolibri_notification);
setPriority(NotificationCompat.PRIORITY_LOW);
setColor(context.getColor(R.color.primary));
try {
setColor(context.getColor(R.color.primary));
} catch (NullPointerException e) {
// This seems to happen on Android 7
// when this method is invoked from Python.
}
setSilent(true);

// Default title
Expand Down

0 comments on commit bf43b56

Please sign in to comment.