fix segfault on import of anonymous sections
[project/uci.git] / file.c
diff --git a/file.c b/file.c
index 4eb35b184ff84b9868b3b4ba1f8ddd08e1b6cc4e..3cd0133d6fc7ef1bd147e97882aa7e9d60e5bfc6 100644 (file)
--- a/file.c
+++ b/file.c
@@ -398,7 +398,7 @@ static void uci_parse_config(struct uci_context *ctx, char **str)
        name = next_arg(ctx, str, false, true);
        assert_eol(ctx, str);
 
        name = next_arg(ctx, str, false, true);
        assert_eol(ctx, str);
 
-       if (!name) {
+       if (!name || !name[0]) {
                ctx->internal = !pctx->merge;
                UCI_NESTED(uci_add_section, ctx, pctx->package, type, &pctx->section);
        } else {
                ctx->internal = !pctx->merge;
                UCI_NESTED(uci_add_section, ctx, pctx->package, type, &pctx->section);
        } else {