mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Properly propagate errors when creating a DataView (fixes #1476)
The C++ code already threw an exception when creating a DataView with size 0, but the corresponding lua wrapper ignored it. Now it's correctly turned into a lua error.
This commit is contained in:
@@ -62,7 +62,8 @@ int w_newDataView(lua_State *L)
|
||||
if (offset < 0 || size < 0)
|
||||
return luaL_error(L, "DataView offset and size must not be negative.");
|
||||
|
||||
DataView *d = instance()->newDataView(data, (size_t) offset, (size_t) size);
|
||||
DataView *d;
|
||||
luax_catchexcept(L, [&]() { d = instance()->newDataView(data, (size_t) offset, (size_t) size); });
|
||||
luax_pushtype(L, d);
|
||||
d->release();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user