File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1691,8 +1691,15 @@ service::AwaitableResolver Result<)cpp"
16911691 []()cpp" << _loader.getSchemaNamespace ()
16921692 << R"cpp( ::)cpp" << enumType.cppType << R"cpp( value, const ResolverParams&)
16931693 {
1694+ const size_t idx = static_cast<size_t>(value);
1695+ if (idx >= s_names)cpp"
1696+ << enumType.cppType << R"cpp( .size())
1697+ {
1698+ throw service::schema_exception { { R"ex(Enum value out of range for )cpp"
1699+ << enumType.type << R"cpp( )ex" } };
1700+ }
16941701 return ResolverResult { { response::ValueToken::EnumValue { std::string { s_names)cpp"
1695- << enumType.cppType << R"cpp( [static_cast<std::size_t>(value) ] } } } };
1702+ << enumType.cppType << R"cpp( [idx ] } } } };
16961703 });
16971704}
16981705
You can’t perform that action at this time.
0 commit comments