TextIterator::advance() should have DCHECK(!atEnd()) at the entry of function. |
||||
Issue descriptionWhen a text iterator is at its end, calling advance() shouldn't do anything. However, it drives the text iterator into an undefined state. Backwards text iterator has the same issue. Given that text iterator is currently in an extremely chaotic status with tons of hacks over each other, we may want to rewrite the class entirely, instead of introducing one more hack over all the existing ones...
,
Nov 13 2017
,
Nov 14
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Nov 19
|
||||
►
Sign in to add a comment |
||||
Comment 1 by yosin@chromium.org
, Mar 9 2017From code health point view, it is not good to call advance() when atEnd() return true. If callers do so, we can think callers do wrong thing. All users of TextIterator should be in following form: for (TextIterator it(...); !it.atEnd(); it.advance()) { ... } We may want to adopt to range-for: for (TextIterator::Result& result : TextIterator(...)) { ... }