Skip to content

Commit 51a4a07

Browse files
authored
Merge pull request #23 from ericcurtin/fix-bugs
erase functions have bugs
2 parents 5d57c98 + 79f1c2d commit 51a4a07

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/minja/minja.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,11 @@ class Value : public std::enable_shared_from_this<Value> {
367367
}
368368
}
369369
void erase(size_t index) {
370-
if (array_) throw std::runtime_error("Value is not an array: " + dump());
370+
if (!array_) throw std::runtime_error("Value is not an array: " + dump());
371371
array_->erase(array_->begin() + index);
372372
}
373373
void erase(const std::string & key) {
374-
if (object_) throw std::runtime_error("Value is not an object: " + dump());
374+
if (!object_) throw std::runtime_error("Value is not an object: " + dump());
375375
object_->erase(key);
376376
}
377377
const Value& at(const Value & index) const {

0 commit comments

Comments
 (0)