Properly retrieve memory block in SkTextUtils Fixes a crash when calling SkTextUtils::GetPath with empty text (or otherwise gets no glyphs to draw). Change-Id: I11711df354be0045ab348bdd7e6cc0c01d3a4e90 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209200 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com> Auto-Submit: Martin Vejdarski <martin@mainframe.co.uk>
diff --git a/src/utils/SkTextUtils.cpp b/src/utils/SkTextUtils.cpp index 3973497..8596a0f 100644 --- a/src/utils/SkTextUtils.cpp +++ b/src/utils/SkTextUtils.cpp
@@ -28,12 +28,12 @@ SkScalar x, SkScalar y, const SkFont& font, SkPath* path) { SkAutoToGlyphs ag(font, text, length, encoding); SkAutoTArray<SkPoint> pos(ag.count()); - font.getPos(ag.glyphs(), ag.count(), &pos[0], {x, y}); + font.getPos(ag.glyphs(), ag.count(), pos.get(), {x, y}); struct Rec { SkPath* fDst; const SkPoint* fPos; - } rec = { path, &pos[0] }; + } rec = { path, pos.get() }; path->reset(); font.getPaths(ag.glyphs(), ag.count(), [](const SkPath* src, const SkMatrix& mx, void* ctx) {