-
Notifications
You must be signed in to change notification settings - Fork 81
Fix failure on getting a list with out of range offset #1947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix failure on getting a list with out of range offset #1947
Conversation
@@ -495,6 +501,9 @@ class Debugger extends Domain { | |||
int? length, | |||
}) async { | |||
String rangeId = objectId; | |||
if (_isEmptyRange(offset: offset, count: count, length: length)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Optional] Conceptually I think an empty range is a type of subrange. Would it make sense to have isSubRange
return true if it's an empty range, and _subRange
return []
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_subrange
does not return a list but a remote object that refers to the sublist. I want to avoid unnecessary 2 roundtrips through the chrome debugger to get the empty list properties when we have all the information available statically.
Alternatively, we could make _subRange
return null
and test for it and return an empty list as a result but I think the current way is clearer...
Basically, It is a bug fix (for when offset >= length
) but also is just an optimization for all empty cases we can detect without the runtime information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fix failure on
getObject
on list with offset greater or equal than the list length.Closes: #1948