diff --git a/dummyflasher.c b/dummyflasher.c
index f64691d8faad8bca49a2acfa7fff656d99658ce1..784cc55e708387c482c72d149af6a26220319277 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -35,7 +35,7 @@ int dummy_init(void)
 	printf_debug("%s\n", __func__);
 
 	/* "all" is equivalent to specifying no type. */
-	if (!strcmp(dummytype, "all")) {
+	if (dummytype && (!strcmp(dummytype, "all"))) {
 		free(dummytype);
 		dummytype = NULL;
 	}