History

Bug in debugger when printing a vm_alloc Bug in vm_string - get_rune/set_rune Update all instantiations of vm_string to use {} - fixed issues

arr committed 9 years ago

Commit bd1f4931 parent 57e9d245 files · +32 −20Browse files

Showing the changes to src/vm/string.cpp (1 of 5 files). Show all

Unified · Split

src/vm/string.cpp+2−2
@@ -397,7 +397,7 @@ word_t vm_string_t::get_length() const · 396 unmodified lines
397397
398398 runtime::rune_t vm_string_t::get_rune(word_t index) const
399399 {
400− if (index < 0 && _length <= index)
400+ if (index < 0 || _length <= index)
401401 throw index_out_of_range_memory{ 0, _length - 1, index };
402402
403403 // Determine if local or allocated memory
@@ -423,7 +423,7 @@ void vm_string_t::set_rune(word_t index, rune_t value) · 19 unmodified lines
423423 throw invalid_utf8{};
424424
425425 // Index equal to length is allowed to grow the string
426− if (index < 0 && _length <= index)
426+ if (index < 0 || _length < index)
427427 throw index_out_of_range_memory{ 0, _length, index };
428428
429429 // Determine if local or allocated memory