check a hashtable before using a bsearch
Review URL: https://codereview.appspot.com/6345097

git-svn-id: http://skia.googlecode.com/svn/trunk@4572 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index a55c9af..f961bc4 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -521,7 +521,7 @@
 }
 
 void SkPictureRecord::addMatrixPtr(const SkMatrix* matrix) {
-    addInt(fMatrices.find(matrix));
+    this->addInt(matrix ? fMatrices.find(*matrix) : 0);
 }
 
 void SkPictureRecord::addPaint(const SkPaint& paint) {
@@ -529,7 +529,7 @@
 }
 
 void SkPictureRecord::addPaintPtr(const SkPaint* paint) {
-    addInt(fPaints.find(paint, &fRCSet, &fTFSet));
+    this->addInt(paint ? fPaints.find(*paint, &fRCSet, &fTFSet) : 0);
 }
 
 void SkPictureRecord::addPath(const SkPath& path) {
@@ -597,7 +597,7 @@
 }
 
 void SkPictureRecord::addRegion(const SkRegion& region) {
-    addInt(fRegions.find(&region));
+    addInt(fRegions.find(region));
 }
 
 void SkPictureRecord::addText(const void* text, size_t byteLength) {
@@ -640,7 +640,7 @@
     
     uint32_t writeFlags = flattenPixels ?
         SkFlattenableWriteBuffer::kForceFlattenBitmapPixels_Flag : 0;
-    int index = fBitmaps.find(&bitmap, &fRCSet, NULL, writeFlags);
+    int index = fBitmaps.find(bitmap, &fRCSet, NULL, writeFlags);
 
     if (flattenPixels) {
         entry.fIndex = index;