aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-09-04 01:25:07 +0200
committerdec05eba <dec05eba@protonmail.com>2022-09-04 01:25:07 +0200
commit84f501f5211f09a09fc5384bf15415d0d0445a96 (patch)
tree21e2364ead11363270f1bc0e54dbe61ebda1c7c7 /src
parentdc096b888bf7cb1edaad2146ebe0588bc65ba78a (diff)
Do not segfault when the program is closed before the window is created
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp6
1 files changed, 5 insertions, 1 deletions
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) {