File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
android/src/main/java/org/reactnative/camera/events Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -70,12 +70,15 @@ private WritableMap serializeEventData() {
70
70
event .putInt ("target" , getViewTag ());
71
71
event .putString ("data" , mBarCode .getText ());
72
72
73
- Formatter formatter = new Formatter ();
74
- for (byte b : mBarCode .getRawBytes ()) {
75
- formatter .format ("%02x" , b );
76
- }
77
- event .putString ("rawData" , formatter .toString ());
78
- formatter .close ();
73
+ byte [] rawBytes = mBarCode .getRawBytes ();
74
+ if (rawBytes != null && rawBytes .length > 0 ) {
75
+ Formatter formatter = new Formatter ();
76
+ for (byte b : rawBytes ) {
77
+ formatter .format ("%02x" , b );
78
+ }
79
+ event .putString ("rawData" , formatter .toString ());
80
+ formatter .close ();
81
+ }
79
82
80
83
event .putString ("type" , mBarCode .getBarcodeFormat ().toString ());
81
84
WritableArray resultPoints = Arguments .createArray ();
You can’t perform that action at this time.
0 commit comments