X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fwim.c;h=500fc1ebc08f7407028be9041fb9f2defe7fbbe2;hp=9dd9718d9500e03f574e175d33dd1b488ae12184;hb=bde99a849d3e7a479cb04a4e16e405b0c2f022dd;hpb=9b9a502863318d6208da2818b1d522346e5eee9e diff --git a/src/wim.c b/src/wim.c index 9dd9718d..500fc1eb 100644 --- a/src/wim.c +++ b/src/wim.c @@ -276,15 +276,15 @@ WIMLIBAPI int wimlib_resolve_image(WIMStruct *w, const char *image_name_or_num) int image; int i; - if (!image_name_or_num) + if (!image_name_or_num || !*image_name_or_num) return WIMLIB_NO_IMAGE; if (strcmp(image_name_or_num, "all") == 0 || strcmp(image_name_or_num, "*") == 0) return WIMLIB_ALL_IMAGES; image = strtol(image_name_or_num, &p, 10); - if (p != image_name_or_num && *p == '\0') { - if (image < 1 || image > w->hdr.image_count) + if (p != image_name_or_num && *p == '\0' && image > 0) { + if (image > w->hdr.image_count) return WIMLIB_NO_IMAGE; return image; } else {