Make Source:seek fail with negative offsets (resolves #667)

This commit is contained in:
Bart van Strien
2013-07-11 14:19:15 +02:00
parent bcc85f884e
commit e382c8939c
+3
View File
@@ -99,6 +99,9 @@ int w_Source_seek(lua_State *L)
{
Source *t = luax_checksource(L, 1);
float offset = (float)luaL_checknumber(L, 2);
if (offset < 0)
return luaL_error(L, "Can't seek to a negative position");
const char *unit = luaL_optstring(L, 3, "seconds");
Source::Unit u;
t->getConstant(unit, u);