Skip to content

Commit c0f4dda

Browse files
committed
Small patch on DynamicObject::toString() implementation.
1 parent a182cd5 commit c0f4dda

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/rhea/core/DynamicObject.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ std::string DynamicObject::toString() {
270270
if(dotPos != std::string::npos) {
271271
numstr.erase(numstr.find_last_not_of('0') + 1);
272272

273-
if(numstr.back() == '.')
273+
if(!numstr.empty() && numstr.back() == '.')
274274
numstr.pop_back();
275275
}
276276

@@ -489,9 +489,8 @@ DynamicObject operator-(
489489
}
490490

491491
size_t index = 0;
492-
while((index = subject.find(subject, index)) != std::string::npos) {
493-
subject.replace(index, rightVal.size(), "");
494-
index++;
492+
while((index = subject.find(object, index)) != std::string::npos) {
493+
subject.replace(index, object.size(), "");
495494
}
496495

497496
return DynamicObject(subject);

0 commit comments

Comments
 (0)