Skip to content

Commit

Permalink
Try to access current row attr only when index is in range
Browse files Browse the repository at this point in the history
  • Loading branch information
skyline75489 committed Oct 1, 2019
1 parent 4a0c7fd commit 1cce2ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/buffer/out/AttrRow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ void ATTR_ROW::ReplaceAttrs(const TextAttribute& toBeReplacedAttr, const TextAtt
{
size_t lowerBound = 0;
size_t upperBound = 0;
for (int i = 0; i < _list.size(); i++)
for (auto i = 0; i < _list.size(); i++)
{
upperBound += _list[i].GetLength();
const auto curr = std::next(_list.begin(), i);
if (iStart >= lowerBound && iStart < upperBound)
{
const auto curr = std::next(_list.begin(), i);
if (curr->GetAttributes() == NewAttr)
{
return S_OK;
Expand Down

0 comments on commit 1cce2ad

Please sign in to comment.