aboutsummaryrefslogtreecommitdiffstats
path: root/src/ports
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2011-07-07 13:04:53 -0700
committerRussell Brenner <russellbrenner@google.com>2011-07-07 13:19:28 -0700
commit8af39c6fd2e903d2b0a2b1b91b295b847a3ec772 (patch)
tree8e60e9fdcc0661b408431181eb7592d4624b0e42 /src/ports
parent7b45a2a7180f3d12d3c01a7eb71aa40b37ef648a (diff)
downloadexternal_skia-8af39c6fd2e903d2b0a2b1b91b295b847a3ec772.zip
external_skia-8af39c6fd2e903d2b0a2b1b91b295b847a3ec772.tar.gz
external_skia-8af39c6fd2e903d2b0a2b1b91b295b847a3ec772.tar.bz2
Add null-check in remove_from_family()
An invalid face is not expected here, but still should not be allowed to crash. Bug: 5002710 Change-Id: Ifd11e918f968d5eef67932e514ea6754819fb7a5
Diffstat (limited to 'src/ports')
-rw-r--r--src/ports/SkFontHost_android.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ports/SkFontHost_android.cpp b/src/ports/SkFontHost_android.cpp
index 982c280..2b3d976 100644
--- a/src/ports/SkFontHost_android.cpp
+++ b/src/ports/SkFontHost_android.cpp
@@ -158,13 +158,17 @@ static SkTypeface* find_from_uniqueID(uint32_t uniqueID) {
*/
static FamilyRec* remove_from_family(const SkTypeface* face) {
FamilyRec* family = find_family(face);
- SkASSERT(family->fFaces[face->style()] == face);
- family->fFaces[face->style()] = NULL;
+ if (family) {
+ SkASSERT(family->fFaces[face->style()] == face);
+ family->fFaces[face->style()] = NULL;
- for (int i = 0; i < 4; i++) {
- if (family->fFaces[i] != NULL) { // family is non-empty
- return NULL;
+ for (int i = 0; i < 4; i++) {
+ if (family->fFaces[i] != NULL) { // family is non-empty
+ return NULL;
+ }
}
+ } else {
+// SkDebugf("remove_from_family(%p) face not found", face);
}
return family; // return the empty family
}