Skip to content

Commit

Permalink
Fix T1410
Browse files Browse the repository at this point in the history
Summary:
Co-authored-by: Wilfrantz DEDE <contact@dede.dev>

We don't understand why there are two versions of many functions: `const type& at() const` and `type& at()`, for example.
`std::vector::at()` does the same thing. Why?

Test Plan: Build with `make ready` and confirm that it works in the use case in T1410.

Reviewers: ardunster

Reviewed By: ardunster

Subscribers: jcmcdonald, wdede, ardunster

Tags: #bss_team, #pawlib_project, #programming_dept

Differential Revision: https://phabricator.mousepawmedia.net/D362
  • Loading branch information
CodeMouse92 committed Nov 28, 2020
1 parent 31794db commit 70cc8a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pawlib-source/include/pawlib/base_flex_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ class Base_FlexArr

const type& at(size_t index) const
{
return at(index);
if(!validateIndex(index, false))
{
throw std::out_of_range("BaseFlexArray: Index out of range!");
}

return internalArray[toInternalIndex(index)];
}

/** Clear all the elements in the array.
Expand Down

0 comments on commit 70cc8a9

Please sign in to comment.