Skip to content

Commit

Permalink
Merge 94fc463 into 01950eb
Browse files Browse the repository at this point in the history
  • Loading branch information
ylavic committed Apr 29, 2019
2 parents 01950eb + 94fc463 commit e1f42de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/rapidjson/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -1149,14 +1149,15 @@ class Schema {
#elif RAPIDJSON_SCHEMA_USE_STDREGEX
template <typename ValueType>
RegexType* CreatePattern(const ValueType& value) {
if (value.IsString())
if (value.IsString()) {
RegexType *r = static_cast<RegexType*>(allocator_->Malloc(sizeof(RegexType)));
try {
return new (r) RegexType(value.GetString(), std::size_t(value.GetStringLength()), std::regex_constants::ECMAScript);
}
catch (const std::regex_error&) {
AllocatorType::Free(r);
}
}
return 0;
}

Expand Down

0 comments on commit e1f42de

Please sign in to comment.