From: NeilBrown Date: Tue, 9 Nov 2021 04:52:14 +0000 (+1100) Subject: oceani: guard against code section being empty. X-Git-Url: https://ocean-lang.org/code/?a=commitdiff_plain;ds=inline;h=20651d69e0f672461c2c458ae07fe98d0c1c6c28;p=ocean oceani: guard against code section being empty. If ->code is empty, we want an error message, not a crash. Signed-off-by: NeilBrown --- diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index 0eaa9c8..6c5b446 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -236,6 +236,11 @@ structures can be used. } } else ss = s; // NOTEST + if (!ss->code) { + fprintf(stderr, "oceani: no code found in requested section\n"); // NOTEST + exit(1); // NOTEST + } + parse_oceani(ss->code, &context.config, dotrace ? stderr : NULL); if (!context.prog) {