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

Fix currentActivity null pointer exception #40

Merged
merged 1 commit into from
Jun 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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