From 84f501f5211f09a09fc5384bf15415d0d0445a96 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 4 Sep 2022 01:25:07 +0200 Subject: Do not segfault when the program is closed before the window is created --- src/QuickMedia.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index f6fe726..7a18f47 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -369,6 +369,8 @@ namespace QuickMedia { } int Program::run(int argc, char **argv) { + mgl_init(); + if(argc < 1) { usage(); return -1; @@ -465,6 +467,9 @@ namespace QuickMedia { usage(); return -1; } + } else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + usage(); + return 0; } else if(argv[i][0] == '-') { fprintf(stderr, "Invalid option %s\n", argv[i]); usage(); @@ -544,7 +549,6 @@ namespace QuickMedia { }; no_video = force_no_video; - mgl_init(); init(parent_window, program_path); if(strcmp(plugin_name, "download") == 0) { -- cgit v1.2.3