diff options
author | mvglasow <michael -at- vonglasow.com> | 2019-08-10 19:23:14 +0200 |
---|---|---|
committer | mvglasow <michael -at- vonglasow.com> | 2019-08-10 19:23:14 +0200 |
commit | aa57acfc3af3e6b30b77ea8c5e44dca8dda97046 (patch) | |
tree | f9050c12131c47c678f69038acf70d8cc57c4e1b | |
parent | f9df2954897d8c2c28e898b28b4a3a924fdbe167 (diff) | |
download | navit-aa57acfc3af3e6b30b77ea8c5e44dca8dda97046.tar.gz |
Fix:traffic:Skip empty lines at start of cached item data
Signed-off-by: mvglasow <michael -at- vonglasow.com>
-rw-r--r-- | navit/traffic.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/navit/traffic.c b/navit/traffic.c index 7e9873107..dd6dc0e6b 100644 --- a/navit/traffic.c +++ b/navit/traffic.c @@ -3394,19 +3394,25 @@ static int traffic_message_restore_segments(struct traffic_message * this_, stru } if (line && (ccnt < 0)) { /* first line with item type and attributes */ + dbg(lvl_debug, "*****checkpoint RESTORE-3, item/attribute line"); pos = 0; type = type_none; id_hi = -1; id_lo = -1; acnt = 0; while (attr_from_line(line, NULL, &pos, value, name)) { + dbg(lvl_debug, "*****checkpoint RESTORE-4, parsing %s=%s", name, value); + ccnt = 0; if (!strcmp(name, "type")) { /* item type */ + dbg(lvl_debug, "*****checkpoint RESTORE-4.1, parsing type: %s", value); type = item_from_name(value); } else if (!strcmp(name, "id")) { /* item ID */ + dbg(lvl_debug, "*****checkpoint RESTORE-4.1, parsing ID: %s", value); sscanf(value, "%d,%d", &id_hi, &id_lo); } else if (!strcmp(name, "flags")) { + dbg(lvl_debug, "*****checkpoint RESTORE-4.1, parsing flags: %s", value); char *tail; if (value[0] == '0' && value[1] == 'x') flags = strtoul(value, &tail, 0); @@ -3417,13 +3423,17 @@ static int traffic_message_restore_segments(struct traffic_message * this_, stru } } else { /* generic attribute */ + dbg(lvl_debug, "*****checkpoint RESTORE-4.1, parsing attribute %s=%s", name, value); attrs[acnt] = attr_new_from_text(name, value); if (attrs[acnt]) acnt++; } } + if (ccnt < 0) { + /* empty line, ignore */ + dbg(lvl_debug, "*****checkpoint RESTORE-4, skipping empty line"); + } attrs[acnt] = NULL; - ccnt = 0; g_free(line); line = NULL; if (data_next) |