Skip to content

Commit

Permalink
fix: Fix SENSOR_INFO_PHYSICAL_SIZE possibly being null on usb devices
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Feb 23, 2024
1 parent 15b3360 commit d890230
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.os.Build
import android.util.Log
import android.util.Range
import android.util.Size
import android.util.SizeF
import android.view.SurfaceHolder
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.ReadableArray
Expand Down Expand Up @@ -68,7 +69,7 @@ class CameraDeviceDetails(private val cameraManager: CameraManager, val cameraId
// 35mm is the film standard sensor size
characteristics.get(CameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS) ?: floatArrayOf(35f)
}
val sensorSize by lazy { characteristics.get(CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE)!! }
val sensorSize by lazy { characteristics.get(CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE) ?: SizeF(0f, 0f) }
val activeSize
get() = characteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE)!!
val sensorOrientation by lazy {
Expand Down

0 comments on commit d890230

Please sign in to comment.