Quickfix for a segfault with file input via -i.

Stuff like

  ./bin/sigrok-cli -i rnd.dd -a transitioncounter

would segfault (rnd.dd consists of random bytes) because device->plugin
was NULL and was being dereferenced.

Thanks Olivier Fauchon <olivier@aixmarseille.com> for reporting.
This commit is contained in:
Uwe Hermann 2011-02-13 11:27:52 +01:00
parent 305bde4d42
commit 218557b85a
1 changed files with 3 additions and 0 deletions

View File

@ -235,6 +235,9 @@ gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap)
{
int *capabilities, i;
if (!device || !device->plugin)
return;
if ((capabilities = device->plugin->get_capabilities()))
for (i = 0; capabilities[i]; i++)
if (capabilities[i] == hwcap)