commit 5a8c96ea4c3392c9cecaff5b05c2cf20e64a64f4
parent 075b16a008ba475361512ca4fbdacb71b156f068
Author: Pandora <Pandora@techfo.xyz>
Date: Wed, 14 Feb 2018 00:46:31 -0500
fix NPE when no background image
Diffstat:
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/i3lock.c b/i3lock.c
@@ -1842,7 +1842,7 @@ int main(int argc, char *argv[]) {
}
}
/* In case loading failed, we just pretend no -i was specified. */
- if (cairo_surface_status(img) != CAIRO_STATUS_SUCCESS) {
+ if (img && cairo_surface_status(img) != CAIRO_STATUS_SUCCESS) {
fprintf(stderr, "Could not load image \"%s\": %s\n",
image_path, cairo_status_to_string(cairo_surface_status(img)));
img = NULL;
diff --git a/jpg.c b/jpg.c
@@ -14,6 +14,7 @@
* Checks if the file is a JPEG by looking for a valid JPEG header.
*/
bool file_is_jpg(char* file_path) {
+ if (!file_path) return false;
FILE* image_file;
uint16_t file_header;
size_t read_count;