[vlc-devel] [PATCH] Avoid calling NSString StringWithUTF8String: with empty (or null) strings.
Andrew Dudman
ajdudman at sbcglobal.net
Sun Oct 7 12:00:55 CEST 2012
---
modules/gui/macosx/open.m | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m
index 5e8044e..a98342e 100644
--- a/modules/gui/macosx/open.m
+++ b/modules/gui/macosx/open.m
@@ -348,6 +348,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
{
int i_index;
module_config_t * p_item;
+ char * psz_encoding;
[o_file_sub_ckbox setTitle: _NS("Load subtitles file:")];
[o_file_sub_path_lbl setStringValue: _NS("Choose a file")];
@@ -376,8 +377,12 @@ static VLCOpen *_o_sharedMainInstance = nil;
p_item = config_FindConfig(VLC_OBJECT(p_intf), "subsdec-encoding");
if (p_item) {
- for (i_index = 0; p_item->list.psz && p_item->list.psz[i_index]; i_index++)
- [o_file_sub_encoding_pop addItemWithTitle: [NSString stringWithUTF8String: p_item->list.psz[i_index]]];
+ if (p_item->list.psz) {
+ for (i_index = 0; i_index < p_item->list_count; i_index++) {
+ psz_encoding = p_item->list.psz[i_index];
+ [o_file_sub_encoding_pop addItemWithTitle: ((psz_encoding && *psz_encoding) ? [NSString stringWithUTF8String: psz_encoding] : @"")];
+ }
+ }
[o_file_sub_encoding_pop selectItemWithTitle:
[NSString stringWithUTF8String: p_item->value.psz]];
--
1.7.11.4
More information about the vlc-devel
mailing list