diff options
-rw-r--r-- | commands/loadxy.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/commands/loadxy.c b/commands/loadxy.c index df14043d69..1e65cb6221 100644 --- a/commands/loadxy.c +++ b/commands/loadxy.c @@ -43,10 +43,10 @@ static int console_change_speed(struct console_device *cdev, int baudrate) { int current_baudrate; + const char *bstr; - current_baudrate = - (int)simple_strtoul(dev_get_param(&cdev->class_dev, - "baudrate"), NULL, 10); + bstr = dev_get_param(&cdev->class_dev, "baudrate"); + current_baudrate = bstr ? (int)simple_strtoul(bstr, NULL, 10) : 0; if (baudrate && baudrate != current_baudrate) { printf("## Switch baudrate from %d to %d bps and press ENTER ...\n", current_baudrate, baudrate); |