AT: Better failure handling and removed wrong unlock
[hayes-ril.git] / network.c
index 6b24467..62d359d 100644 (file)
--- a/network.c
+++ b/network.c
@@ -182,8 +182,10 @@ int at_creg_handle(char **registration_state, struct at_response_data **response
        }
 
        asprintf(&(registration_state[0]), "%d", state);
-       registration_state[1] = strdup(lac);
-       registration_state[2] = strdup(cid);
+       if(lac != NULL)
+               registration_state[1] = strdup(lac);
+       if(cid != NULL)
+               registration_state[2] = strdup(cid);
 
        return 0;
 }