From 114ad986e458d15c12d13d83a1df88d5d0f8308a Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Mon, 15 Jul 2019 19:34:02 +0300 Subject: [PATCH] C: fix initialization code --- core/src/main/resources/org/teavm/backend/c/runtime.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/src/main/resources/org/teavm/backend/c/runtime.c b/core/src/main/resources/org/teavm/backend/c/runtime.c index 3255ca6d2..b27e8d5d1 100644 --- a/core/src/main/resources/org/teavm/backend/c/runtime.c +++ b/core/src/main/resources/org/teavm/backend/c/runtime.c @@ -466,11 +466,7 @@ char* teavm_char16ToMb(char16_t* javaChars, int32_t length) { } TeaVM_Array* teavm_parseArguments(int argc, char** argv) { - int arraySize = argc - 1; - if (arraySize < 0) { - arraySize - 1; - } - TeaVM_Array* array = teavm_allocateStringArray(arraySize); + TeaVM_Array* array = teavm_allocateStringArray(argc > 0 ? argc - 1 : 0); TeaVM_String** arrayData = TEAVM_ARRAY_DATA(array, TeaVM_String*); for (int i = 1; i < argc; ++i) { arrayData[i - 1] = teavm_cToString(argv[i]);