Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android]java.lang.ArrayIndexOutOfBoundsException: length=0; index=0 #350 #378

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 10 additions & 1 deletion android/src/main/java/com/beefe/picker/PickerViewModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;

import java.lang.ArrayIndexOutOfBoundsException;

import java.util.ArrayList;

import static android.graphics.Color.argb;
Expand Down Expand Up @@ -303,7 +305,14 @@ public void onClick(View v) {
ReadableArray pickerData = options.getArray(PICKER_DATA);

int pickerViewHeight;
String name = pickerData.getType(0).name();
String name = "";
try {
name = pickerData.getType(0).name();
}catch(ArrayIndexOutOfBoundsException aioobe){
//Fix-it: it may throw java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
//Cannot find out the reason. So just prevent it to crash the application.
aioobe.printStackTrace();
}
switch (name) {
case "Map":
curStatus = 1;
Expand Down