Fix empty string issue in ext/args (#1921)

Now the js string "" can be converted to C array by jerryx_arg_string

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
This commit is contained in:
Zidong Jiang
2017-07-14 23:41:02 +08:00
committed by Akos Kiss
parent 00f93bc287
commit 8c9b0d4086
2 changed files with 12 additions and 3 deletions
+2 -2
View File
@@ -259,10 +259,10 @@ jerryx_arg_string_common_routine (jerry_value_t js_arg, /**< JS arg */
target_p,
target_buf_size);
if (size == 0 || size == target_buf_size)
if ((size == target_buf_size) || (size == 0 && jerry_get_string_length (js_arg) != 0))
{
return jerry_create_error (JERRY_ERROR_TYPE,
(jerry_char_t *) "The size of the buffer is not large enough.");
(jerry_char_t *) "Buffer size is not large enough.");
}
target_p[size] = '\0';