ui/nc: Don't segfault if we can't open log_file
[petitboot] / ui / ncurses / generic-main.c
index 5d8debbbacd09ba3a53c9f49ab7e219f11e386aa..365034ceea3c402d1870e33fa627d80c9fcb4539 100644 (file)
@@ -231,6 +231,9 @@ int main(int argc, char *argv[])
        if (strcmp(opts.log_file, "-")) {
                FILE *log = fopen(opts.log_file, "a");
 
+               if (!log)
+                       log = fopen("/dev/null", "a");
+
                assert(log);
                pb_log_set_stream(log);
        } else