handle empty action strings correctly
This commit is contained in:
@@ -712,6 +712,11 @@ static int cyberiada_decode_edge_action(const char* text, CyberiadaAction** acti
|
|||||||
|
|
||||||
buffer = utf8_encode(text, strlen(text), &buffer_len);
|
buffer = utf8_encode(text, strlen(text), &buffer_len);
|
||||||
|
|
||||||
|
if (!buffer) {
|
||||||
|
*action = NULL;
|
||||||
|
return CYBERIADA_NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if ((res = regexec(&cyberiada_edge_action_regexp, buffer,
|
if ((res = regexec(&cyberiada_edge_action_regexp, buffer,
|
||||||
CYBERIADA_ACTION_REGEXP_MATCHES, pmatch, 0)) != 0) {
|
CYBERIADA_ACTION_REGEXP_MATCHES, pmatch, 0)) != 0) {
|
||||||
if (res == REG_NOMATCH) {
|
if (res == REG_NOMATCH) {
|
||||||
@@ -835,6 +840,10 @@ static int cyberiada_decode_state_actions(const char* text, CyberiadaAction** ac
|
|||||||
|
|
||||||
*actions = NULL;
|
*actions = NULL;
|
||||||
|
|
||||||
|
if (!buffer) {
|
||||||
|
return CYBERIADA_NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
while (*next) {
|
while (*next) {
|
||||||
start = next;
|
start = next;
|
||||||
block = strstr(start, CYBERIADA_NEWLINE);
|
block = strstr(start, CYBERIADA_NEWLINE);
|
||||||
@@ -897,9 +906,12 @@ static int cyberiada_decode_state_actions_yed(const char* text, CyberiadaAction*
|
|||||||
|
|
||||||
buffer = utf8_encode(text, strlen(text), &buffer_len);
|
buffer = utf8_encode(text, strlen(text), &buffer_len);
|
||||||
next = buffer;
|
next = buffer;
|
||||||
|
|
||||||
*actions = NULL;
|
*actions = NULL;
|
||||||
|
|
||||||
|
if (!buffer) {
|
||||||
|
return CYBERIADA_NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
while (*next) {
|
while (*next) {
|
||||||
start = next;
|
start = next;
|
||||||
while (*start && isspace(*start)) start++;
|
while (*start && isspace(*start)) start++;
|
||||||
|
|||||||
Reference in New Issue
Block a user