aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-03-24 01:07:51 +0000
committerThomas White <taw@bitwiz.org.uk>2009-03-24 01:07:51 +0000
commit05cf81da2d23f04151cd24823cd32e1095b01dcf (patch)
tree1d6cf39851952381d95103e6fc5656b0af8e4840
parenteac1474a8031ec367a9f21c367e65df9fe8b99fc (diff)
Add a forgotten check for failure to open the accel threshold file
-rw-r--r--src/accelerometers.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/accelerometers.c b/src/accelerometers.c
index 2a657a3..9933657 100644
--- a/src/accelerometers.c
+++ b/src/accelerometers.c
@@ -83,6 +83,11 @@ static void accelerometer_freerunner_try_threshold(AccelHandle *accel)
/* Save the old threshold */
fh = accelerometer_freerunner_open_threshold("r");
+ if ( fh == NULL ) {
+ fprintf(stderr, "Couldn't read old accelerometer threshold.\n");
+ accel->old_threshold = -1;
+ return;
+ }
rval = fscanf(fh, "%i", &accel->old_threshold);
if ( rval != 1 ) {
/* Failed */