From 1483ab6a88edd904513b21596d8ef61838418ef4 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Tue, 25 Oct 2016 16:40:09 -0600 Subject: [PATCH] ds18b20: add additional check for no devices found Signed-off-by: Jon Trulson --- src/ds18b20/ds18b20.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ds18b20/ds18b20.c b/src/ds18b20/ds18b20.c index 11eb06d4..bfee586c 100644 --- a/src/ds18b20/ds18b20.c +++ b/src/ds18b20/ds18b20.c @@ -144,7 +144,7 @@ ds18b20_context ds18b20_init(unsigned int uart) rv = mraa_uart_ow_rom_search(dev->ow, 0, id); } - if (!dev->numDevices) + if (!dev->numDevices || !dev->devices) { printf("%s: no DS18B20 devices found on bus\n", __FUNCTION__); ds18b20_close(dev);