-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[vector_graphics]Add Null Check for Image Retrieval in listener.dart's onDrawImage Function #9211
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
Conversation
…error messages, and enhance the robustness and maintainability of the code.
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
This change is exempt from additional testing as it does not alter any existing functionality. |
Thanks for the submission! In the future, please do not delete things from the checklist that is in the PR template; they are there for a reason. This PR is missing required elements described in the checklist (I’ve restored the missing parts to the PR description), which need to be addressed before it moves forward with review. I am marking the PR as a Draft. Please review the checklist, updating the PR as appropriate, and when that’s complete please feel free to mark the PR as ready for review.
Could you quote the part of the linked documentation about the test requirement that led you to believe that bugfixes are exempt from testing? |
…ages. - Ensure validity checks are performed before accessing images. - Provide informative error messages for better debugging. - Improve code robustness and maintainability.
…eId in onDrawImage.
@stuartmorgan-g |
@stuartmorgan-g @jonahwilliams There’s a PR that has been forgotten on a mysterious branch. Come rescue it! |
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
# Conflicts: # packages/vector_graphics/CHANGELOG.md
# Conflicts: # packages/vector_graphics/CHANGELOG.md
@domesticmouse hi, could you please take a moment to review my PR? |
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.
Please reply to review questions.
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.
Regarding the cause of the image decoding failure, I believe the issue may lie within the onImage method. If an error occurs while loading the image, _images[imageId] might not be assigned a value. This can lead to a null error when we subsequently attempt to access that value.
To address this issue, I recommend adding a null check for _images[imageId] in the drawing logic. This will allow us to gracefully handle situations where the image fails to load, preventing the application from crashing and enhancing overall stability.
In the unit test, we verify that when attempting to draw an image with an invalid imageId, the program correctly throws an assertion error. This helps developers identify potential issues early during the debugging phase, thereby enhancing the reliability and maintainability of the code.
@jonahwilliams should I just land this, or is there an auto land process for this repo? |
Uh I dunno, let's try autosub label |
…ener.dart's onDrawImage Function (flutter/packages#9211)
…ener.dart's onDrawImage Function (flutter/packages#9211)
…ener.dart's onDrawImage Function (flutter/packages#9211)
…ener.dart's onDrawImage Function (flutter/packages#9211)
flutter/packages@974f152...0b322a2 2025-06-11 stuartmorgan@google.com Roll Flutter master to 2d9977c (flutter/packages#9402) 2025-06-11 stuartmorgan@google.com [google_maps_flutter] Fix iOS analysis for newer Xcode (flutter/packages#9415) 2025-06-10 shaunpanjabi@gmail.com [in_app_purchase] Return jwsRepresentation and jsonRepresentation for StoreKit2 (flutter/packages#9280) 2025-06-10 stuartmorgan@google.com Roll Flutter master to 7e30df2 (flutter/packages#9413) 2025-06-10 42757204+wyqlxf@users.noreply.github.com [vector_graphics]Add Null Check for Image Retrieval in listener.dart's onDrawImage Function (flutter/packages#9211) 2025-06-10 stuartmorgan@google.com Roll Flutter master to 8b22f67 (flutter/packages#9407) 2025-06-06 stuartmorgan@google.com Roll Flutter master to d8baa77 (flutter/packages#9379) 2025-06-06 ybz975218925@gmail.com Fix the `zIndex`-related issue in the `copyWith` method. (flutter/packages#9396) 2025-06-06 katelovett@google.com [multi] Remove @tool from docs that does not work (flutter/packages#9394) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This PR adds error handling for #168364
Pre-Review Checklist
[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under[^1].CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under[^1].///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.