diff --git a/tools/emulator/system/camera/EmulatedCameraFactory.cpp b/tools/emulator/system/camera/EmulatedCameraFactory.cpp index 9bfc7269f..5c5c5dec1 100755 --- a/tools/emulator/system/camera/EmulatedCameraFactory.cpp +++ b/tools/emulator/system/camera/EmulatedCameraFactory.cpp @@ -123,7 +123,7 @@ int EmulatedCameraFactory::cameraDeviceOpen(int camera_id, hw_device_t** device) return -EINVAL; } - if (camera_id >= getEmulatedCameraNum()) { + if (camera_id < 0 || camera_id >= getEmulatedCameraNum()) { LOGE("%s: Camera id %d is out of bounds (%d)", __FUNCTION__, camera_id, getEmulatedCameraNum()); return -EINVAL; @@ -141,7 +141,7 @@ int EmulatedCameraFactory::getCameraInfo(int camera_id, struct camera_info* info return -EINVAL; } - if (camera_id >= getEmulatedCameraNum()) { + if (camera_id < 0 || camera_id >= getEmulatedCameraNum()) { LOGE("%s: Camera id %d is out of bounds (%d)", __FUNCTION__, camera_id, getEmulatedCameraNum()); return -EINVAL; diff --git a/tools/emulator/system/camera/EmulatedFakeCamera.cpp b/tools/emulator/system/camera/EmulatedFakeCamera.cpp index 3b6e91b4e..d82fd787f 100755 --- a/tools/emulator/system/camera/EmulatedFakeCamera.cpp +++ b/tools/emulator/system/camera/EmulatedFakeCamera.cpp @@ -50,11 +50,10 @@ status_t EmulatedFakeCamera::Initialize() } /* Fake camera facing is defined by the qemu.sf.fake_camera boot property. */ - const char* facing = EmulatedCamera::FACING_BACK; char prop[PROPERTY_VALUE_MAX]; - if (property_get("qemu.sf.fake_camera", prop, NULL) > 0) { - facing = prop; - } + property_get("qemu.sf.fake_camera", prop, EmulatedCamera::FACING_BACK); + const char* facing = prop; + mParameters.set(EmulatedCamera::FACING_KEY, facing); LOGD("%s: Fake camera is facing %s", __FUNCTION__, facing);