initio.c: Add fix for passing null pointer as argument
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
committed by
Mihai Tudor Panu
parent
88a8bb22b6
commit
8ded6f1f6d
@@ -171,7 +171,7 @@ parse_uart(char** proto, size_t n, const char* proto_full)
|
|||||||
|
|
||||||
/* Check for bytesize. */
|
/* Check for bytesize. */
|
||||||
int bytesize = -1;
|
int bytesize = -1;
|
||||||
if (mraa_atoi_x(proto[idx], &end, &bytesize, 0) != MRAA_SUCCESS) {
|
if (proto[idx] != NULL && mraa_atoi_x(proto[idx], &end, &bytesize, 0) != MRAA_SUCCESS) {
|
||||||
syslog(LOG_ERR, "parse_uart: error reading uart bytesize '%d' from '%s'", bytesize, proto_full);
|
syslog(LOG_ERR, "parse_uart: error reading uart bytesize '%d' from '%s'", bytesize, proto_full);
|
||||||
mraa_uart_stop(dev);
|
mraa_uart_stop(dev);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user