Update demand.c
Fixing bug in get_category_name when category_name is NULL
@@ -119,7 +119,12 @@ void set_pattern_index(list_node_t *lnode, int pattern_index)
char *get_category_name(list_node_t *lnode)
// Be advised: caller must free memory returned
{
- return strdup(get_demand_data(lnode)->category_name);
+ char *temp = get_demand_data(lnode)->category_name;
+
+ if (temp)
+ return strdup(temp);
+ else
+ return NULL;
}
void set_category_name(list_node_t *lnode, const char *category_name)
