-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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 npe during skia dispatch of drawAtlas #55497
base: main
Are you sure you want to change the base?
Conversation
sk_colors.reserve(count); | ||
for (int i = 0; i < count; ++i) { | ||
sk_colors.push_back(colors[i].argb()); | ||
} | ||
} | ||
canvas_->drawAtlas(skia_atlas.get(), xform, ToSkRects(tex), sk_colors.data(), |
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.
Unfortunately .data()
is not guaranteed to return nullptr for empty std::vector. We need to explicitly send it here.
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.
damn you STL
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, just a suggestion and a question
canvas_->drawAtlas(skia_atlas.get(), xform, ToSkRects(tex), sk_colors.data(), | ||
count, ToSk(mode), ToSk(sampling), ToSkRect(cullRect), | ||
canvas_->drawAtlas(skia_atlas.get(), xform, ToSkRects(tex), | ||
colors == nullptr ? nullptr : sk_colors.data(), count, |
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.
colors == nullptr ? nullptr : sk_colors.data(), count, | |
sk_colors.empty() ? nullptr : sk_colors.data(), count, |
This is a more direct condition =)
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.
Done
testing/dart/canvas_test.dart
Outdated
|
||
final Image resultImage = await recorder.endRecording().toImage(1, 1); | ||
final ByteData? data = await resultImage.toByteData(); | ||
if (data == null) { |
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.
why not use an expect
?
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.
Oh, I guess this is from old litetest days.
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.
Done
auto label is removed for flutter/engine/55497, due to - The status or check suite Mac mac_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label. |
You were fast to correct the ticket, thanks!! |
auto label is removed for flutter/engine/55497, due to - The status or check suite Mac mac_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Colors are optionally provided, so make sure to null check the array.
Fixes flutter/flutter#155783