diff options
| author | Philipp Andreas <github@smurfy.de> | 2014-10-28 23:36:32 +0100 |
|---|---|---|
| committer | Philipp Andreas <github@smurfy.de> | 2014-10-28 23:36:32 +0100 |
| commit | b5ecd0a0778ad8e1d0de49b4f49271b458acefda (patch) | |
| tree | 0c4b6d36be78569733dbba6ceb16f1fabca9a2c4 | |
| parent | 763f16d504ab9667679aebdb461a0d365708938b (diff) | |
Segfault fix.
| -rw-r--r-- | daemon/watchconnector.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/daemon/watchconnector.cpp b/daemon/watchconnector.cpp index d91d183..a240b04 100644 --- a/daemon/watchconnector.cpp +++ b/daemon/watchconnector.cpp @@ -90,6 +90,16 @@ QString WatchConnector::decodeEndpoint(uint val) void WatchConnector::decodeMsg(QByteArray data) { + //Sometimes pebble sends a "00", we ignore it without future action + if (data.length() == 1 && data.at(0) == 0) { + return; + } + + if (data.length() < 4) { + logger()->error() << "Can not decode message data length invalid: " << data.toHex(); + return; + } + unsigned int datalen = 0; int index = 0; datalen = (data.at(index) << 8) + data.at(index+1); |
