diff --git a/bootloader.c b/bootloader.c index b690c55..f3dc268 100644 --- a/bootloader.c +++ b/bootloader.c @@ -30,23 +30,33 @@ static int set_bootloader_message_block(const struct bootloader_message *in, con int get_bootloader_message(struct bootloader_message *out) { Volume* v = volume_for_path("/misc"); - if (strcmp(v->fs_type, "mtd") == 0) { - return get_bootloader_message_mtd(out, v); - } else if (strcmp(v->fs_type, "emmc") == 0) { - return get_bootloader_message_block(out, v); + if(v) + { + if (strcmp(v->fs_type, "mtd") == 0) { + return get_bootloader_message_mtd(out, v); + } else if (strcmp(v->fs_type, "emmc") == 0) { + return get_bootloader_message_block(out, v); + } + LOGE("unknown misc partition fs_type \"%s\"\n", v->fs_type); + return -1; } - LOGE("unknown misc partition fs_type \"%s\"\n", v->fs_type); + LOGE("no misc partition\n"); return -1; } int set_bootloader_message(const struct bootloader_message *in) { Volume* v = volume_for_path("/misc"); - if (strcmp(v->fs_type, "mtd") == 0) { - return set_bootloader_message_mtd(in, v); - } else if (strcmp(v->fs_type, "emmc") == 0) { - return set_bootloader_message_block(in, v); + if(v) + { + if (strcmp(v->fs_type, "mtd") == 0) { + return set_bootloader_message_mtd(in, v); + } else if (strcmp(v->fs_type, "emmc") == 0) { + return set_bootloader_message_block(in, v); + } + LOGE("unknown misc partition fs_type \"%s\"\n", v->fs_type); + return -1; } - LOGE("unknown misc partition fs_type \"%s\"\n", v->fs_type); + LOGE("no misc partition\n"); return -1; }