Skip to content

Commit 5bfcc1a

Browse files
committed
CpuTextureManager: Add missing null check
1 parent 70d5420 commit 5bfcc1a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/cputexturemanager.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,13 @@ bool CpuTextureManager::textureContainsPoint(const Texture &texture, const QPoin
116116
return false;
117117

118118
GLubyte *pixels = getTextureData(texture);
119-
QRgb color = qRgba(pixels[(y * width + x) * 4], pixels[(y * width + x) * 4 + 1], pixels[(y * width + x) * 4 + 2], pixels[(y * width + x) * 4 + 3]);
120-
return qAlpha(color) > 0;
119+
120+
if (pixels) {
121+
QRgb color = qRgba(pixels[(y * width + x) * 4], pixels[(y * width + x) * 4 + 1], pixels[(y * width + x) * 4 + 2], pixels[(y * width + x) * 4 + 3]);
122+
return qAlpha(color) > 0;
123+
}
124+
125+
return false;
121126
}
122127

123128
void CpuTextureManager::removeTexture(const Texture &texture)

0 commit comments

Comments
 (0)