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#\",";