]> granicus.if.org Git - handbrake/commitdiff
WinGui: Fix a potential crash in the OptionsTabNameConverter. Fixes #1784
authorsr55 <sr55.hb@outlook.com>
Fri, 4 Jan 2019 21:37:11 +0000 (21:37 +0000)
committersr55 <sr55.hb@outlook.com>
Fri, 4 Jan 2019 21:37:11 +0000 (21:37 +0000)
win/CS/HandBrakeWPF/Converters/Options/OptionsTabNameConverter.cs

index 5c0fb47f05c47d2c75e0515a8c1a58c2ba42b8bd..26919a351f0d6b3f339ef637ea83ea2f26f5a260 100644 (file)
@@ -13,8 +13,6 @@ namespace HandBrakeWPF.Converters.Options
     using System.Globalization;\r
     using System.Windows.Data;\r
 \r
-    using HandBrake.Interop.Utilities;\r
-\r
     using HandBrakeWPF.Model;\r
     using HandBrakeWPF.Utilities;\r
 \r
@@ -43,7 +41,12 @@ namespace HandBrakeWPF.Converters.Options
         /// </returns>\r
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\r
         {\r
-            return EnumHelper<OptionsTab>.GetDisplay((OptionsTab)value);\r
+            if (value != null)\r
+            {\r
+                return EnumHelper<OptionsTab>.GetDisplay((OptionsTab)value);\r
+            }\r
+\r
+            return null;\r
         }\r
 \r
         /// <summary>\r
@@ -66,7 +69,12 @@ namespace HandBrakeWPF.Converters.Options
         /// </returns>\r
         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\r
         {\r
-            return EnumHelper<OptionsTab>.GetValue(value.ToString());\r
+            if (value != null)\r
+            {\r
+                return EnumHelper<OptionsTab>.GetValue(value.ToString());\r
+            }\r
+\r
+            return null;\r
         }\r
     }\r
 }
\ No newline at end of file