We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00d8878 commit 7189f3dCopy full SHA for 7189f3d
src/SchemaGenerator.cpp
@@ -1322,8 +1322,16 @@ service::AwaitableResolver Result<)cpp"
1322
{
1323
response::Value result(response::Type::EnumValue);
1324
1325
+ const size_t idx = static_cast<size_t>(value);
1326
+ if (idx<0 || idx >= s_names)cpp"
1327
+ << enumType.cppType << R"cpp(.size())
1328
+ {
1329
+ throw service::schema_exception { { R"ex(Enum value out of range for )cpp"
1330
+ << enumType.type << R"cpp()ex" } };
1331
+ }
1332
+
1333
result.set<std::string>(std::string { s_names)cpp"
- << enumType.cppType << R"cpp([static_cast<size_t>(value)] });
1334
+ << enumType.cppType << R"cpp([idx] });
1335
1336
return result;
1337
});
0 commit comments