barcordscan crash when scaning some barcode

🐛 Bug Report

barcordscan crash when scaning some barcode.

Summary of Issue (just a few sentences)

When use https://barcode.tec-it.com/zh/RSS14?data=0123456789012 generator a GS1 DataBar code and use camera to scaning the barcode then app crash.

Environment – output of expo diagnostics & the platform(s) you’re targeting

Expo CLI 3.21.5 environment info:

Platform: android
Version: android 8.0.0
Device Brand: XIAOMI
Device Model:  MIX

System:
      OS: macOS 10.15.5
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 14.3.0 - /usr/local/bin/node
      Yarn: 1.22.4 - /usr/local/bin/yarn
      npm: 6.14.5 - /usr/local/bin/npm
    IDEs:
      Android Studio: 4.0 AI-193.6911.18.40.6514223
      Xcode: 11.5/11E608c - /usr/bin/xcodebuild
    npmPackages:
      expo: ~37.0.3 => 37.0.6 
      react: ~16.9.0 => 16.9.0 
      react-dom: ~16.9.0 => 16.9.0 
      react-native: ~0.61.5 => 0.61.5 
      react-native-web: ~0.11.7 => 0.11.7 
    npmGlobalPackages:
      expo-cli: 3.21.5

"dependencies": {
    "@react-native-community/masked-view": "0.1.6",
    "@react-navigation/native": "^5.1.5",
    "@react-navigation/stack": "^5.2.10",
    "expo": "~37.0.3",
    "expo-auth-session": "^1.1.0",
    "expo-barcode-scanner": "^8.1.0",
    "expo-camera": "^8.2.0",
    "expo-constants": "^9.0.0",
    "expo-crypto": "^8.1.0",
    "expo-local-authentication": "^9.0.0",
    "expo-random": "^8.1.0",
    "expo-secure-store": "^8.1.0",
    "expo-splash-screen": "^0.2.3",
    "expo-updates": "~0.2.0",
    "expo-web-browser": "^8.2.0",
    "jcore-react-native": "^1.8.0",
    "jpush-react-native": "^2.8.1",
    "js-base64": "^2.5.2",
    "mobx": "^5.15.4",
    "mobx-react": "^6.2.2",
    "qs": "^6.9.3",
    "react": "~16.9.0",
    "react-dom": "~16.9.0",
    "react-native": "~0.61.5",
    "react-native-gesture-handler": "~1.6.0",
    "react-native-get-random-values": "^1.3.1",
    "react-native-reanimated": "~1.7.0",
    "react-native-safe-area-context": "^0.7.3",
    "react-native-screens": "~2.2.0",
    "react-native-unimodules": "~0.9.0",
    "react-native-web": "~0.11.7",
    "react-native-webview": "8.1.1",
    "reflect-metadata": "^0.1.13"
  }

Log in android studio

2020-06-28 20:52:46.823 30620-30665/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
    Process: com.cat.fedlogin.app, PID: 30620
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:353)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
        at expo.modules.barcodescanner.scanners.ZxingBarCodeScanner.scan(ZxingBarCodeScanner.java:86)
        at expo.modules.barcodescanner.scanners.ZxingBarCodeScanner.scan(ZxingBarCodeScanner.java:66)
        at expo.modules.camera.tasks.BarCodeScannerAsyncTask.doInBackground(BarCodeScannerAsyncTask.java:36)
        at expo.modules.camera.tasks.BarCodeScannerAsyncTask.doInBackground(BarCodeScannerAsyncTask.java:6)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
        at java.lang.Thread.run(Thread.java:764) 
2020-06-28 20:52:47.127 1313-3475/? W/ActivityManager:   Force finishing activity com.cat.fedlogin.app/.MainActivity
2020-06-28 20:52:47.324 1313-1796/? W/InputDispatcher: channel '651fac0 com.cat.fedlogin.app/com.cat.fedlogin.app.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
2020-06-28 20:52:47.325 1313-1796/? E/InputDispatcher: channel '651fac0 com.cat.fedlogin.app/com.cat.fedlogin.app.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

Reproducible Demo

Use Expo android client
Expo android client version: 2.15.4

Steps to Reproduce

  1. Open https://barcode.tec-it.com/zh/RSS14?data=0123456789012 then generator a GS1 DataBar barcode
  2. Open expo android client application
  3. Open Expo APIs
  4. Tap Expo Camera component
  5. Tap three dot button and select barcode icon button
  6. Scan the barcode of first step generator barcode

Expected Behavior vs Actual Behavior

Expected: application not to crash
Actual: application crash

1 possible answer(s) on “barcordscan crash when scaning some barcode