Browse Source

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

Bart van Strien 12 years ago
parent
commit
e382c8939c
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/modules/audio/wrap_Source.cpp

+ 3 - 0
src/modules/audio/wrap_Source.cpp

@@ -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);