Diff between 6f40e88d0bd52d5b25f869d536996f9e462f1643 and 55f561a9cd0be9f939eaa6804b30fa67b3005002

Changed Files

File Additions Deletions Status
src/shared/shell.c +8 -6 modified

Full Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index f3f7bab..2ecc41b 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -1328,13 +1328,15 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt)
 				}
 			}
 
-			if (c != opt->options[index - offset].val) {
-				usage(argc, argv, opt);
-				exit(EXIT_SUCCESS);
-				return;
-			}
+			if (opt) {
+				if (c != opt->options[index - offset].val) {
+					usage(argc, argv, opt);
+					exit(EXIT_SUCCESS);
+					return;
+				}
 
-			*opt->optarg[index - offset] = optarg ? : "";
+				*opt->optarg[index - offset] = optarg ? : "";
+			}
 		}
 
 		index = -1;