Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

check when setting timer seconds and allow 0 #156

Merged
merged 2 commits into from

2 participants

@winniehell

No description provided.

@nicolasgramlich

Doesn't this cause an infinite loop when auto-resetting is turned on?

@winniehell

yep, it did... fixed now.
(I tried to disable the timer by setting it to 0 - so now my workaround is to set it to a random number and setTimerCallbackTriggered(true) )

@nicolasgramlich nicolasgramlich merged commit e5efa2b into from
@winniehell winniehell deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/org/andengine/engine/handler/timer/TimerHandler.java
View
6 src/org/andengine/engine/handler/timer/TimerHandler.java
@@ -34,7 +34,7 @@ public TimerHandler(final float pTimerSeconds, final ITimerCallback pTimerCallba
public TimerHandler(final float pTimerSeconds, final boolean pAutoReset, final ITimerCallback pTimerCallback) {
if(pTimerSeconds <= 0){
- throw new IllegalStateException("pTimerSeconds must be >= 0!");
+ throw new IllegalStateException("pTimerSeconds must be > 0!");
}
this.mTimerSeconds = pTimerSeconds;
@@ -55,6 +55,10 @@ public void setAutoReset(final boolean pAutoReset) {
}
public void setTimerSeconds(final float pTimerSeconds) {
+ if(pTimerSeconds <= 0){
+ throw new IllegalStateException("pTimerSeconds must be > 0!");
+ }
+
this.mTimerSeconds = pTimerSeconds;
}
Something went wrong with that request. Please try again.