SkShaper: better error info.
Change-Id: Ie7966e22282ef25861cc775bd0904c113ded76c1
Reviewed-on: https://skia-review.googlesource.com/c/171523
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/modules/skshaper/src/SkShaper_harfbuzz.cpp b/modules/skshaper/src/SkShaper_harfbuzz.cpp
index 47630d5..8c15e33 100644
--- a/modules/skshaper/src/SkShaper_harfbuzz.cpp
+++ b/modules/skshaper/src/SkShaper_harfbuzz.cpp
@@ -75,7 +75,14 @@
return nullptr;
}
int index;
- HBBlob blob(stream_to_blob(std::unique_ptr<SkStreamAsset>(tf->openStream(&index))));
+ std::unique_ptr<SkStreamAsset> typefaceAsset(tf->openStream(&index));
+ if (!typefaceAsset) {
+ SkString name;
+ tf->getFamilyName(&name);
+ SkDebugf("Typeface '%s' has no data :(\n", name.c_str());
+ return nullptr;
+ }
+ HBBlob blob(stream_to_blob(std::move(typefaceAsset)));
HBFace face(hb_face_create(blob.get(), (unsigned)index));
SkASSERT(face);
if (!face) {