From 7f1c4a1c4c254679436bd5cd8cbfd0341fa86310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Tue, 15 Sep 2020 17:12:34 +0200 Subject: [PATCH] Utils: simplified string list lookup --- src/Utils.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index 4ac3577d..1abb27ab 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -52,15 +52,13 @@ obs_bounds_type getBoundsTypeFromName(QString name) { } bool Utils::StringInStringList(char** strings, const char* string) { + if (!strings) { + return false; + } + size_t index = 0; - char* value = nullptr; - - while (1) { - value = strings[index]; - - if (value == nullptr) { - return false; - } + while (strings[index] != NULL) { + char* value = strings[index]; if (strcmp(value, string) == 0) { return true; @@ -68,6 +66,7 @@ bool Utils::StringInStringList(char** strings, const char* string) { index++; } + return false; }