]> granicus.if.org Git - handbrake/commitdiff
LinGui: handle missing default preset better
authorJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 8 Aug 2018 22:10:10 +0000 (15:10 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Thu, 9 Aug 2018 21:45:15 +0000 (14:45 -0700)
Search for original default official preset.  If still missing, select
first available preset.

Addresses problem seen in:
https://github.com/HandBrake/HandBrake/pull/1524

(cherry picked from commit 42972a019972147c239f0f8b1a06ffa05c28e737)

gtk/src/presets.c

index b2ef25089243dcd5ed1a30b4831ddf419704b0ef..361a4a70ec19be3908987f1c15d57c517a06ee1f 100644 (file)
@@ -634,6 +634,20 @@ ghb_select_default_preset(signal_user_data_t *ud)
     hb_preset_index_t *path;
 
     path = hb_presets_get_default_index();
+    if (path == NULL || path->depth == 0)
+    {
+        // No default set, find original "default" preset
+        g_free(path);
+        path = hb_preset_search_index("Fast 1080p30", 1, HB_PRESET_TYPE_ALL);
+    }
+    if (path == NULL || path->depth == 0)
+    {
+        int index[2] = {0, 0};
+
+        // Could not find original default, try first available preset
+        g_free(path);
+        path = hb_preset_index_init(index, 2);
+    }
     if (path != NULL)
     {
         select_preset2(ud, path);