Fixed ParticleSystems and Files crashing instead of erroring when given bad sizes (issue #666)

This commit is contained in:
Alex Szpakowski
2013-07-04 06:29:02 -03:00
parent ee5e83635f
commit abd31ca4e2
4 changed files with 18 additions and 4 deletions
+3
View File
@@ -136,6 +136,9 @@ FileData *File::read(int64 size)
int64 cur = tell();
size = (size == ALL) ? max : size;
if (size < 0)
throw love::Exception("Invalid read size.");
// Clamping because the file offset may be in a weird position.
if (cur < 0)
cur = 0;