mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Improved the error message when nil is passed as the first argument to love.image.newImageData (resolves issue #1205).
This commit is contained in:
@@ -68,19 +68,24 @@ int w_newImageData(lua_State *L)
|
||||
t->release();
|
||||
return 1;
|
||||
}
|
||||
else if (filesystem::luax_cangetfiledata(L, 1)) // Case 2: File(Data).
|
||||
{
|
||||
filesystem::FileData *data = love::filesystem::luax_getfiledata(L, 1);
|
||||
|
||||
// Case 2: File(Data).
|
||||
love::filesystem::FileData *data = love::filesystem::luax_getfiledata(L, 1);
|
||||
ImageData *t = nullptr;
|
||||
luax_catchexcept(L,
|
||||
[&]() { t = instance()->newImageData(data); },
|
||||
[&](bool) { data->release(); }
|
||||
);
|
||||
|
||||
ImageData *t = nullptr;
|
||||
luax_catchexcept(L,
|
||||
[&]() { t = instance()->newImageData(data); },
|
||||
[&](bool) { data->release(); }
|
||||
);
|
||||
|
||||
luax_pushtype(L, IMAGE_IMAGE_DATA_ID, t);
|
||||
t->release();
|
||||
return 1;
|
||||
luax_pushtype(L, IMAGE_IMAGE_DATA_ID, t);
|
||||
t->release();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return luax_typerror(L, 1, "value");
|
||||
}
|
||||
}
|
||||
|
||||
int w_newCompressedData(lua_State *L)
|
||||
|
||||
Reference in New Issue
Block a user