Utils: simplified string list lookup

This commit is contained in:
Stéphane Lepin
2020-09-15 17:12:34 +02:00
parent 2e32b7e299
commit 7f1c4a1c4c

View File

@ -52,22 +52,21 @@ obs_bounds_type getBoundsTypeFromName(QString name) {
} }
bool Utils::StringInStringList(char** strings, const char* string) { bool Utils::StringInStringList(char** strings, const char* string) {
size_t index = 0; if (!strings) {
char* value = nullptr;
while (1) {
value = strings[index];
if (value == nullptr) {
return false; return false;
} }
size_t index = 0;
while (strings[index] != NULL) {
char* value = strings[index];
if (strcmp(value, string) == 0) { if (strcmp(value, string) == 0) {
return true; return true;
} }
index++; index++;
} }
return false; return false;
} }