[vlc-commits] macosx: simple prefs: robustify and cleanup saving int and string list

David Fuhrmann git at videolan.org
Mon Jan 20 18:33:21 CET 2014


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Mon Jan 20 18:21:56 2014 +0100| [f35551e50cea30238b6a532436b93cf352bf5ff2] | committer: David Fuhrmann

macosx: simple prefs: robustify and cleanup saving int and string list

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f35551e50cea30238b6a532436b93cf352bf5ff2
---

 modules/gui/macosx/simple_prefs.m |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/modules/gui/macosx/simple_prefs.m b/modules/gui/macosx/simple_prefs.m
index ab28a33..9ff33a7 100644
--- a/modules/gui/macosx/simple_prefs.m
+++ b/modules/gui/macosx/simple_prefs.m
@@ -871,18 +871,20 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam
 
 static inline void save_int_list(intf_thread_t * p_intf, id object, const char * name)
 {
-    NSNumber *p_valueobject;
-    p_valueobject = (NSNumber *)[[object selectedItem] representedObject];
-    assert([p_valueobject isKindOfClass:[NSNumber class]]);
-    if (p_valueobject) config_PutInt(p_intf, name, [p_valueobject intValue]);
+    NSNumber *p_valueobject = (NSNumber *)[[object selectedItem] representedObject];
+    if (p_valueobject) {
+        assert([p_valueobject isKindOfClass:[NSNumber class]]);
+        config_PutInt(p_intf, name, [p_valueobject intValue]);
+    }
 }
 
 static inline void save_string_list(intf_thread_t * p_intf, id object, const char * name)
 {
-    NSString *p_stringobject;
-    p_stringobject = (NSString *)[[object selectedItem] representedObject];
-    assert([p_stringobject isKindOfClass:[NSString class]]);
-    config_PutPsz(p_intf, name, [p_stringobject UTF8String]);
+    NSString *p_stringobject = (NSString *)[[object selectedItem] representedObject];
+    if (p_stringobject) {
+        assert([p_stringobject isKindOfClass:[NSString class]]);
+        config_PutPsz(p_intf, name, [p_stringobject UTF8String]);
+    }
 }
 
 - (void)saveChangedSettings



More information about the vlc-commits mailing list