From 01ecb88d1399aedf0f326a2f99bd8d03f7f90585 Mon Sep 17 00:00:00 2001 From: CK Tan Date: Sat, 18 Nov 2017 11:57:45 -0800 Subject: [PATCH] Fix issue #3 --- toml.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toml.c b/toml.c index 0e00a83..669d6d2 100644 --- a/toml.c +++ b/toml.c @@ -1140,6 +1140,10 @@ static void parse_select(context_t* ctx) /* [[x.y.z]] -> create z = [] in x.y */ toml_array_t* arr = create_keyarray_in_table(ctx, ctx->curtab, z, 1 /*skip_if_exist*/); + if (!arr) { + e_syntax_error(ctx, z.lineno, "key exists"); + return; + } if (arr->kind == 0) arr->kind = 't'; if (arr->kind != 't') { e_syntax_error(ctx, z.lineno, "array mismatch");