diff --git a/dmserver/src/screen_rotation_controller.cpp b/dmserver/src/screen_rotation_controller.cpp index 03d68c40..c6dc1f4c 100644 --- a/dmserver/src/screen_rotation_controller.cpp +++ b/dmserver/src/screen_rotation_controller.cpp @@ -413,6 +413,9 @@ SensorRotation ScreenRotationController::CalcSensorRotation(int sensorDegree) DeviceRotation ScreenRotationController::ConvertSensorToDeviceRotation(SensorRotation sensorRotation) { + if (sensorToDeviceRotationMap_.empty()) { + ProcessRotationMapping(); + } return sensorToDeviceRotationMap_.at(sensorRotation); } @@ -421,6 +424,9 @@ Rotation ScreenRotationController::ConvertDeviceToDisplayRotation(DeviceRotation if (deviceRotation == DeviceRotation::INVALID) { return GetCurrentDisplayRotation(); } + if (deviceToDisplayRotationMap_.empty()) { + ProcessRotationMapping(); + } return deviceToDisplayRotationMap_.at(deviceRotation); }