[vlc-commits] ios dialog provider: fix insufficient nil checks

Felix Paul Kühne git at videolan.org
Sat May 24 14:26:52 CEST 2014


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat May 24 14:26:42 2014 +0200| [8402ed45ea0c11b35650cf1e901cd023f2b2666b] | committer: Felix Paul Kühne

ios dialog provider: fix insufficient nil checks

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

 modules/gui/ios_dialog_provider/dialogProvider.m |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/gui/ios_dialog_provider/dialogProvider.m b/modules/gui/ios_dialog_provider/dialogProvider.m
index f72ab3a..8b9e1f8 100644
--- a/modules/gui/ios_dialog_provider/dialogProvider.m
+++ b/modules/gui/ios_dialog_provider/dialogProvider.m
@@ -200,8 +200,12 @@ static int DisplayLogin(vlc_object_t *p_this, const char *type, vlc_value_t prev
     intf_sys_t *sys = p_intf->p_sys;
     NSDictionary *dict = [sys->displayer displayLogin:DictFromDialogLogin(dialog)];
     if (dict) {
-        *dialog->username = strdup([[dict objectForKey:@"username"] UTF8String]);
-        *dialog->password = strdup([[dict objectForKey:@"password"] UTF8String]);
+        NSString *username = [dict objectForKey:@"username"];
+        if (username != NULL && username.length > 0)
+            *dialog->username = strdup([username UTF8String]);
+        NSString *password = [dict objectForKey:@"password"];
+        if (password != NULL && password.length > 0)
+            *dialog->password = strdup([password UTF8String]);
     }
     [pool release];
     return VLC_SUCCESS;



More information about the vlc-commits mailing list