Skip to content

Commit

Permalink
Properly clear error flag after checking for entry location
Browse files Browse the repository at this point in the history
Fixes gammu/wammu#23

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed May 10, 2016
1 parent 0e883ec commit 81b27fa
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions gammu/src/convertors/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,17 +407,18 @@ int MemoryEntryFromPython(PyObject * dict, GSM_MemoryEntry * entry,

location = GetCharFromDict(item, "Location");
if (location == NULL) {
entry->Entries[i].Location = PBK_Location_Unknown;
} else {
if (strcmp(location, "Home") == 0) {
entry->Entries[i].Location = PBK_Location_Home;
} else if (strcmp(location, "Work") == 0) {
entry->Entries[i].Location = PBK_Location_Work;
} else {
entry->Entries[i].Location = PBK_Location_Unknown;
}
free(location);
}
PyErr_Clear();
entry->Entries[i].Location = PBK_Location_Unknown;
} else {
if (strcmp(location, "Home") == 0) {
entry->Entries[i].Location = PBK_Location_Home;
} else if (strcmp(location, "Work") == 0) {
entry->Entries[i].Location = PBK_Location_Work;
} else {
entry->Entries[i].Location = PBK_Location_Unknown;
}
free(location);
}

/* Zero everything, just to be sure */
entry->Entries[i].Text[0] = 0;
Expand Down

0 comments on commit 81b27fa

Please sign in to comment.