From cbbd6aca04676ac7484d53fb56131bbb1943a225 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 11 Nov 2019 22:33:27 +0300 Subject: [PATCH] add check for root_type specified for json schema generation (#5622) --- src/idl_gen_json_schema.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/idl_gen_json_schema.cpp b/src/idl_gen_json_schema.cpp index 5d7bad6d8..b152fb202 100644 --- a/src/idl_gen_json_schema.cpp +++ b/src/idl_gen_json_schema.cpp @@ -122,6 +122,7 @@ class JsonSchemaGenerator : public BaseGenerator { : BaseGenerator(base_generator) {} bool generate() { + if (parser_.root_struct_def_ == nullptr) { return false; } code_.Clear(); code_ += "{"; code_ += " \"$schema\": \"http://json-schema.org/draft-04/schema#\",";