aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk/GrVkGpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/vk/GrVkGpu.cpp')
-rw-r--r--src/gpu/vk/GrVkGpu.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 87970b5e1c..17fccfb1bb 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -642,8 +642,12 @@ bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex,
// texels is const.
// But we may need to adjust the fPixels ptr based on the copyRect, or fRowBytes.
// Because of this we need to make a non-const shallow copy of texels.
- SkAutoTMalloc<GrMipLevel> texelsShallowCopy(mipLevelCount);
- memcpy(texelsShallowCopy.get(), texels, mipLevelCount*sizeof(GrMipLevel));
+ SkAutoTMalloc<GrMipLevel> texelsShallowCopy;
+
+ if (mipLevelCount) {
+ texelsShallowCopy.reset(mipLevelCount);
+ memcpy(texelsShallowCopy.get(), texels, mipLevelCount*sizeof(GrMipLevel));
+ }
for (int currentMipLevel = 0; currentMipLevel < mipLevelCount; ++currentMipLevel) {
SkASSERT(texelsShallowCopy[currentMipLevel].fPixels);