diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c
index c440bf9477041c67138ca66f7dcfa49e3cda1ff2..2790bc867303ba0b7cb0d701dfcbaeb4bc0526fe 100644
--- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c
+++ b/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c
@@ -28,6 +28,13 @@ GEN_TYPE_boolean lrf_is_noval() {
 
 /** Get one distance measurement from the laser range finder. */
 GEN_TYPE_int lrf_read() {
+
+    if (uart_filestream == -1)
+        return -1;
+
+    // free buffer
+    uart_flush();
+
     char bytes[5];
     int n_read = 0;
 
@@ -38,9 +45,6 @@ GEN_TYPE_int lrf_read() {
 
     int d;
 
-    // free buffer
-    uart_flush();
-
     // looks like a blocking call and actually is but is always very fast
     // since it only has to read the queue
     while (1) {