summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/screensaver.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/launcher/screensaver.cpp b/core/launcher/screensaver.cpp
index 45da9ed..088ed19 100644
--- a/core/launcher/screensaver.cpp
+++ b/core/launcher/screensaver.cpp
@@ -188,6 +188,8 @@ void OpieScreenSaver::setBacklight ( int bright )
188 if ( i < sl. count ( )) 188 if ( i < sl. count ( ))
189 m_sensordata [i] = sl [i]. toInt ( ); 189 m_sensordata [i] = sl [i]. toInt ( );
190 } 190 }
191 if ( m_sensordata [LS_Steps] < 2 ) // sanity check to avoid SIGFPE
192 m_sensordata [LS_Steps] = 2;
191 193
192 timerEvent ( 0 ); 194 timerEvent ( 0 );
193 startTimer ( m_sensordata [LS_Interval] ); 195 startTimer ( m_sensordata [LS_Interval] );
@@ -233,7 +235,7 @@ void OpieScreenSaver::timerEvent ( QTimerEvent * )
233 int dx = m_sensordata [LS_SensorMax] - m_sensordata [LS_SensorMin]; 235 int dx = m_sensordata [LS_SensorMax] - m_sensordata [LS_SensorMin];
234 int dy = m_sensordata [LS_LightMax] - m_sensordata [LS_LightMin]; 236 int dy = m_sensordata [LS_LightMax] - m_sensordata [LS_LightMin];
235 237
236 int stepno = ( s - m_sensordata [LS_SensorMin] ) * m_sensordata [LS_Steps] / dx; 238 int stepno = ( s - m_sensordata [LS_SensorMin] ) * m_sensordata [LS_Steps] / dx; // dx is never 0
237 239
238 m_backlight_sensor = m_sensordata [LS_LightMax] - dy * stepno / ( m_sensordata [LS_Steps] - 1 ); 240 m_backlight_sensor = m_sensordata [LS_LightMax] - dy * stepno / ( m_sensordata [LS_Steps] - 1 );
239 } 241 }