v0.9.0: added safety checks to prevent a few rare crashes

This commit is contained in:
Evan Debenham
2020-09-18 01:35:33 -04:00
parent 9e6a349f2a
commit 023f746df7
3 changed files with 12 additions and 6 deletions

View File

@@ -93,7 +93,7 @@ public class Camera extends Gizmo {
int length = all.size();
for (int i=0; i < length; i++) {
Camera c = all.get( i );
if (c.exists && c.active) {
if (c != null && c.exists && c.active) {
c.update();
}
}

View File

@@ -62,7 +62,8 @@ public class MovieClip extends Image {
frameTimer += Game.elapsed;
while (frameTimer > curAnim.delay) {
frameTimer -= curAnim.delay;
if (curFrame == curAnim.frames.length - 1) {
if (curFrame >= curAnim.frames.length - 1) {
curFrame = curAnim.frames.length - 1;
if (curAnim.looped) {
curFrame = 0;
}