break in case of null terminator

This commit is contained in:
Chris Cromer 2021-07-17 17:23:05 -04:00
parent ce9f6a321f
commit 71d74c3324

View File

@ -133,6 +133,9 @@ void set_variable(StringArray *args) {
// Check variable name for invalid characters // Check variable name for invalid characters
for (size_t i = 0; i < strlen(variable); i++) { for (size_t i = 0; i < strlen(variable); i++) {
if (variable[i] == 0) {
break;
}
if (!((variable[i] >= 48 && variable[i] <= 57) || if (!((variable[i] >= 48 && variable[i] <= 57) ||
(variable[i] >= 65 && variable[i] <= 90) || (variable[i] >= 65 && variable[i] <= 90) ||
(variable[i] >= 97 && variable[i] <= 122))) { (variable[i] >= 97 && variable[i] <= 122))) {