prefs: Avoid empty elements in string lists.
When parsing a comma-separated string list from file we should not add an empty element if this list is empty. Otherwise we would get an empty string in when writing the file back. Change-Id: Iea5a33d20991f8c5daed6811beb8ec97b8b1dbe3 Reviewed-on: https://code.wireshark.org/review/21870 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
561be48f40
commit
c72c08809b
|
@ -3612,7 +3612,8 @@ prefs_get_string_list(const gchar *str)
|
|||
return NULL;
|
||||
}
|
||||
slstr[j] = '\0';
|
||||
sl = g_list_append(sl, slstr);
|
||||
if (j > 0)
|
||||
sl = g_list_append(sl, slstr);
|
||||
break;
|
||||
}
|
||||
if (cur_c == '"' && ! backslash) {
|
||||
|
@ -3648,7 +3649,8 @@ prefs_get_string_list(const gchar *str)
|
|||
and it wasn't preceded by a backslash; it's the end of
|
||||
the string we were working on... */
|
||||
slstr[j] = '\0';
|
||||
sl = g_list_append(sl, slstr);
|
||||
if (j > 0)
|
||||
sl = g_list_append(sl, slstr);
|
||||
|
||||
/* ...and the beginning of a new string. */
|
||||
state = PRE_STRING;
|
||||
|
|
Loading…
Reference in New Issue