Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #40 from drivetribe/fix/getclass_nullpointer
Browse files Browse the repository at this point in the history
Fix currentActivity null pointer exception
  • Loading branch information
jordanbyron authored Jun 9, 2017
2 parents 2b99081 + c71c4d0 commit c5c4084
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ public void setShortcutItems(ReadableArray items) {
return;
}

Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
return;
}

Context context = getReactApplicationContext();
mShortcutItems = new ArrayList<>(items.size());
List<ShortcutInfo> shortcuts = new ArrayList<>(items.size());
Expand All @@ -99,7 +104,7 @@ public void setShortcutItems(ReadableArray items) {

int iconResId = context.getResources()
.getIdentifier(item.icon, "drawable", context.getPackageName());
Intent intent = new Intent(context, getCurrentActivity().getClass());
Intent intent = new Intent(context, currentActivity.getClass());
intent.setAction(ACTION_SHORTCUT);
intent.putExtra(SHORTCUT_TYPE, item.type);

Expand Down

0 comments on commit c5c4084

Please sign in to comment.