Mercurial > mplayer.hg
changeset 34588:94a4e81f214a
Prevent reading empty lines.
author | ib |
---|---|
date | Thu, 09 Feb 2012 15:12:58 +0000 |
parents | ba16576126fa |
children | 6327e5a74a5e |
files | gui/cfg.c |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/cfg.c Thu Feb 09 15:02:16 2012 +0000 +++ b/gui/cfg.c Thu Feb 09 15:12:58 2012 +0000 @@ -277,6 +277,9 @@ while (fgetstr(line, sizeof(line), file)) { plItem *item; + if (!*line) + continue; + item = calloc(1, sizeof(plItem)); if (!item) { @@ -286,7 +289,7 @@ item->path = strdup(line); - if (fgetstr(line, sizeof(line), file)) { + if (fgetstr(line, sizeof(line), file) && *line) { item->name = strdup(line); listSet(gtkAddPlItem, item); } else { @@ -309,6 +312,9 @@ while (fgetstr(line, sizeof(line), file)) { urlItem *item; + if (!*line) + continue; + item = calloc(1, sizeof(urlItem)); if (!item) { @@ -334,7 +340,7 @@ unsigned int i = 0; while (fgetstr(line, sizeof(line), file)) - if (i < FF_ARRAY_ELEMS(fsHistory)) + if (*line && (i < FF_ARRAY_ELEMS(fsHistory))) fsHistory[i++] = gstrdup(line); fclose(file);