diff --git a/src/modules/image/CompressedData.cpp b/src/modules/image/CompressedData.cpp index 132e9f784..2f55d806c 100644 --- a/src/modules/image/CompressedData.cpp +++ b/src/modules/image/CompressedData.cpp @@ -49,7 +49,7 @@ void *CompressedData::getData() const { // Data for different mipmap levels is not stored contiguously in memory, so // getData() won't work properly for CompressedData. - if (dataImages.size() > 0) + if (dataImages.size() > 0 && dataImages[0].size > 0) return (void *) &(dataImages[0].data[0]); else return 0; diff --git a/src/modules/image/wrap_ImageData.cpp b/src/modules/image/wrap_ImageData.cpp index 2dd3a8c3d..0e5a91255 100644 --- a/src/modules/image/wrap_ImageData.cpp +++ b/src/modules/image/wrap_ImageData.cpp @@ -85,7 +85,7 @@ int w_ImageData_setPixel(lua_State *L) c.r = luaL_checkint(L, 4); c.g = luaL_checkint(L, 5); c.b = luaL_checkint(L, 6); - c.a = luaL_optint(L,7,255); + c.a = luaL_optint(L, 7, 255); try { t->setPixel(x, y, c); @@ -123,7 +123,7 @@ int w_ImageData_mapPixel(lua_State *L) c.r = luaL_optint(L, -4, 0); c.g = luaL_optint(L, -3, 0); c.b = luaL_optint(L, -2, 0); - c.a = luaL_optint(L, -1, 0); + c.a = luaL_optint(L, -1, 255); t->setPixel(i, j, c); lua_pop(L, 4); }