summaryrefslogtreecommitdiffhomepage
path: root/src/rlgl.h
diff options
context:
space:
mode:
authorRay <[email protected]>2023-10-19 13:05:50 +0200
committerRay <[email protected]>2023-10-19 13:05:50 +0200
commit19ff0e5fb1bbac46921ab34f922e77461c13c11f (patch)
treedd91492a46b5114ae7331c6fb9f70a8d8e1cc0de /src/rlgl.h
parentfc6152613f4bb97708935a9f8096d2ca4d9fbb76 (diff)
downloadraylib-19ff0e5fb1bbac46921ab34f922e77461c13c11f.tar.gz
raylib-19ff0e5fb1bbac46921ab34f922e77461c13c11f.zip
REVIEWED: `rlLoadTexture()` #3440
Diffstat (limited to 'src/rlgl.h')
-rw-r--r--src/rlgl.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 40e7b478..e38642ec 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -3000,7 +3000,8 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
int mipOffset = 0; // Mipmap data offset, only used for tracelog
// NOTE: Added pointer math separately from function to avoid UBSAN complaining
- unsigned char *dataPtr = (unsigned char *)data;
+ unsigned char *dataPtr = NULL;
+ if (data != NULL) dataPtr = (unsigned char *)data;
// Load the different mipmap levels
for (int i = 0; i < mipmapCount; i++)
@@ -3040,7 +3041,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
mipWidth /= 2;
mipHeight /= 2;
mipOffset += mipSize; // Increment offset position to next mipmap
- dataPtr += mipSize; // Increment data pointer to next mipmap
+ if (data != NULL) dataPtr += mipSize; // Increment data pointer to next mipmap
// Security check for NPOT textures
if (mipWidth < 1) mipWidth = 1;