mirror of
https://github.com/tristanpenman/valijson.git
synced 2025-01-31 14:39:53 +01:00
Add range check to MaxItemsConstraint and MaxLengthConstraint classes
This commit is contained in:
parent
2bcaaac344
commit
0f81f72a26
@ -437,6 +437,11 @@ public:
|
||||
|
||||
void setMaxItems(int64_t newMaxItems)
|
||||
{
|
||||
if (newMaxItems < 0) {
|
||||
throw std::runtime_error(
|
||||
"Maximum number of items must be a non-negative integer");
|
||||
}
|
||||
|
||||
maxItems = newMaxItems;
|
||||
}
|
||||
|
||||
@ -464,6 +469,11 @@ public:
|
||||
|
||||
void setMaxLength(int64_t newMaxLength)
|
||||
{
|
||||
if (newMaxLength < 0) {
|
||||
throw std::runtime_error(
|
||||
"Maximum length must be a non-negative integer");
|
||||
}
|
||||
|
||||
maxLength = newMaxLength;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user