Index: trunk/BNC/GPSS/gpssDecoder.cpp
===================================================================
--- trunk/BNC/GPSS/gpssDecoder.cpp	(revision 1437)
+++ trunk/BNC/GPSS/gpssDecoder.cpp	(revision 1438)
@@ -80,4 +80,6 @@
   _buffer += QByteArray(data, dataLen);
 
+  bool obsFound = false;
+  bool ephFound = false;
   int iBeg;
   while ( (iBeg = _buffer.indexOf(0x02)) != -1) {
@@ -89,5 +91,5 @@
     // Observations
     // ------------
-    if      (char(_buffer[1]) == 0x00) {
+    if      (_buffer.length() > 0 && char(_buffer[1]) == 0x00) {
 
       int reqLength = 2 + sizeof(recordSize) + sizeof(EPOCHHEADER);
@@ -109,4 +111,5 @@
           if (crc == crcCal) {
             for (int is = 0; is < epochHdr.n_svs; is++) {
+              obsFound = true;
               t_obs* obs = new t_obs();
               memcpy(&(obs->_o), _buffer.data() + 2 + sizeof(recordSize) + 
@@ -123,7 +126,7 @@
     // Ephemeris
     // ---------
-    else if (char(_buffer[1]) == 0x01) {
+    else if (_buffer.length() > 0 && char(_buffer[1]) == 0x01) {
       int reqLength = 2 + sizeof(recordSize) + sizeof(gpsephemeris) +
-        sizeof(crc) + 1;
+                      sizeof(crc) + 1;
 
       if (_buffer.length() >= reqLength) {
@@ -134,4 +137,5 @@
 
         if (crc == crcCal) {
+          ephFound = true;
           gpsephemeris* gpsEph = new gpsephemeris;
           memcpy(gpsEph, _buffer.data() + 2 + sizeof(recordSize), 
@@ -148,4 +152,9 @@
   }
 
-  return success;
+  if (obsFound || ephFound) {
+    return success;
+  }
+  else {
+    return failure;
+  }
 }
