Fix CloseDevice segfault when no device is open
Brought to you by:
mr_brain
Currently, calling CloseDevice() before any device is created leads to a segfault. The following adds a simple test to avoid that:
--- /home/jhenin/tmp/libk8055.c 2008-08-20 19:01:56.000000000 +0200 +++ libk8055.0.4.1/libk8055.c 2014-08-27 10:33:39.947338618 +0200 @@ -294,7 +294,7 @@ { int rc; - if (CurrDev->DevNo == 0) + if (CurrDev == NULL || CurrDev->DevNo == 0) { if (DEBUG) fprintf(stderr, "Current device is not open\n" );