Index: src/core/SkOrderedWriteBuffer.cpp |
diff --git a/src/core/SkOrderedWriteBuffer.cpp b/src/core/SkOrderedWriteBuffer.cpp |
index 9c31b4c4d7309c71b775376a8422da0bd19bd91c..1c15e43ef02eb08d7d434c2b893e0a1488f069ab 100644 |
--- a/src/core/SkOrderedWriteBuffer.cpp |
+++ b/src/core/SkOrderedWriteBuffer.cpp |
@@ -270,7 +270,10 @@ void SkOrderedWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) { |
factory = flattenable->getFactory(); |
} |
if (NULL == factory) { |
- if (fFactorySet != NULL || fNamedFactorySet != NULL) { |
+ if (this->isValidating()) { |
+ this->writeString(""); |
+ SkASSERT(NULL == flattenable); // We shouldn't get in here in this scenario |
+ } else if (fFactorySet != NULL || fNamedFactorySet != NULL) { |
this->write32(0); |
} else { |
this->writeFunctionPtr(NULL); |
@@ -290,7 +293,9 @@ void SkOrderedWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) { |
* name. SkGPipe uses this technique so it can write the name to its |
* stream before writing the flattenable. |
*/ |
- if (fFactorySet) { |
+ if (this->isValidating()) { |
+ this->writeString(flattenable->getTypeName()); |
+ } else if (fFactorySet) { |
this->write32(fFactorySet->add(factory)); |
} else if (fNamedFactorySet) { |
int32_t index = fNamedFactorySet->find(factory); |