Fix Macro device data crash

If you attempt to download from a Macro device
and use wrong device or initial read fails then
it crashes, this patch fixes that.

It does not fix more general data errors but should
at least mean incorrect user selections do not result
in GC crashing.

Fixes #366.
This commit is contained in:
Mark Liversedge
2011-08-21 21:14:03 +01:00
parent bfa68faeda
commit 7352245a91

View File

@@ -114,6 +114,13 @@ MacroDevice::download(CommPortPtr dev, const QDir &tmpdir,
MacroPacket response = MacroPacket();
response.read(dev, 2, err);
if (response.payload.size() == 0)
{
err = "no data";
return false;
}
char count = response.payload.at(0);
if (count == 0)