Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions benchmark_apis/c_api_driver/cuopt_json_to_c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,15 @@ int parse_cuopt_json(const char* filename, ProblemData* data) {
cJSON* type_item = types->child;
while (bound_item && type_item && i < data->num_constraints) {
cuopt_float_t bound_value = parse_numeric_value(bound_item);
char* type = type_item->valuestring;
if (strcmp(type, "L") == 0) { // Less than or equal
char* type = cJSON_IsString(type_item) ? type_item->valuestring : NULL;

if (type && strcmp(type, "L") == 0) { // Less than or equal
data->constraint_lower_bounds[i] = -CUOPT_INFINITY;
data->constraint_upper_bounds[i] = bound_value;
} else if (strcmp(type, "G") == 0) { // Greater than or equal
} else if (type && strcmp(type, "G") == 0) { // Greater than or equal
data->constraint_lower_bounds[i] = bound_value;
data->constraint_upper_bounds[i] = CUOPT_INFINITY;
} else if (strcmp(type, "E") == 0) { // Equal
} else if (type && strcmp(type, "E") == 0) { // Equal
data->constraint_lower_bounds[i] = bound_value;
data->constraint_upper_bounds[i] = bound_value;
}
Expand Down Expand Up @@ -431,8 +431,8 @@ int parse_cuopt_json(const char* filename, ProblemData* data) {
i = 0;
cJSON* type_item;
cJSON_ArrayForEach(type_item, variable_types) {
char* type_str = type_item->valuestring;
if (strcmp(type_str, "I") == 0) {
char* type_str = cJSON_IsString(type_item) ? type_item->valuestring : NULL;
if (type_str && strcmp(type_str, "I") == 0) {
data->variable_types[i] = CUOPT_INTEGER;
} else {
data->variable_types[i] = CUOPT_CONTINUOUS;
Expand Down