aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkData.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkData.cpp')
-rw-r--r--src/core/SkData.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp
index 2653f327c0..496d599379 100644
--- a/src/core/SkData.cpp
+++ b/src/core/SkData.cpp
@@ -112,10 +112,13 @@ SkData* SkData::NewSubset(const SkData* src, size_t offset, size_t length) {
}
SkData* SkData::NewWithCString(const char cstr[]) {
- if (NULL == cstr || 0 == cstr[0]) {
- return NewEmpty();
+ size_t size;
+ if (NULL == cstr) {
+ cstr = "";
+ size = 1;
} else {
- return NewWithCopy(cstr, strlen(cstr));
+ size = strlen(cstr) + 1;
}
+ return NewWithCopy(cstr, size);
}