summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-05-26 08:24:36 -0700
committerRaph Levien <raph@google.com>2014-05-27 15:40:17 +0000
commit7c382381191b2280b53c375fe83dfc6217bbdfa9 (patch)
tree958a4b94155bc2ad64a92d6214e8b27cf96f5288 /libs
parent4d4e6bc8118d15542f1f2a9218f0f7a91a29474f (diff)
downloadandroid_frameworks_minikin-7c382381191b2280b53c375fe83dfc6217bbdfa9.tar.gz
android_frameworks_minikin-7c382381191b2280b53c375fe83dfc6217bbdfa9.tar.bz2
android_frameworks_minikin-7c382381191b2280b53c375fe83dfc6217bbdfa9.zip
Fix for bug 15252902 native crash in Minikin
This is a fix for bug 15252902 "Crash observed on keep launch or existing youtube app after playing video". It was doing the test for a null font after trying to resolve the font in a cache, which caused a crash when there was no font for the run. This patch just tests before cache lookup. Change-Id: Iee41f7ce6b69cb09438462b6aaa916f242da7b77
Diffstat (limited to 'libs')
-rw-r--r--libs/minikin/Layout.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/minikin/Layout.cpp b/libs/minikin/Layout.cpp
index 886b7d1..3935eb7 100644
--- a/libs/minikin/Layout.cpp
+++ b/libs/minikin/Layout.cpp
@@ -615,13 +615,13 @@ void Layout::doLayoutRun(const uint16_t* buf, size_t start, size_t count, size_t
float y = 0;
for (size_t run_ix = 0; run_ix < items.size(); run_ix++) {
FontCollection::Run &run = items[run_ix];
+ if (run.font == NULL) {
+ ALOGE("no font for run starting u+%04x length %d", buf[run.start], run.end - run.start);
+ continue;
+ }
int font_ix = findFace(run.font, ctx);
ctx->paint.font = mFaces[font_ix];
hb_font_t* hbFont = ctx->hbFonts[font_ix];
- if (ctx->paint.font == NULL) {
- // TODO: should log what went wrong
- continue;
- }
#ifdef VERBOSE
std::cout << "Run " << run_ix << ", font " << font_ix <<
" [" << run.start << ":" << run.end << "]" << std::endl;