mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[Impeller] Fix crash trying to check for duplicate vertices in shadow_path code (#180920)
The new general convex path shadow code was checking for duplicate vertices without actually checking if the vectors contained any vertices. Thus, <vector>.back() was being called on empty vectors, which is bad. This led to a crash in G3 as their code is being run with a vector implementation that protects against this, but apparently we do not have such a vector implementation in our local building and testing. No tests because this covered by existing test cases and a new FML_DCHECK, however I'm not sure if we have DCHECKs enabled in CI...?
This commit is contained in:
parent
1bc18aad90
commit
a9a2c79924
@ -1359,8 +1359,11 @@ uint16_t PolygonInfo::AppendVertex(const Point& vertex, Scalar gaussian) {
|
||||
FML_DCHECK(index == gaussians_.size());
|
||||
// TODO(jimgraham): Turn this condition into a failure of the tessellation
|
||||
FML_DCHECK(index <= std::numeric_limits<uint16_t>::max());
|
||||
if (gaussian == gaussians_.back() && vertex == vertices_.back()) {
|
||||
return index - 1;
|
||||
if (index > 0u) {
|
||||
FML_DCHECK(!gaussians_.empty() && !vertices_.empty());
|
||||
if (gaussian == gaussians_.back() && vertex == vertices_.back()) {
|
||||
return index - 1;
|
||||
}
|
||||
}
|
||||
vertices_.push_back(vertex);
|
||||
gaussians_.push_back(gaussian);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user