Skip to content

Commit 95d458c

Browse files
author
Builder
committed
Merge branch '5488-sdk-no-check-on-setframeduration' into 'master'
[FIX][SDK] no check on setframeduration See merge request codingame/game-engine!181
2 parents a9ffbd8 + b5f0059 commit 95d458c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

engine/core/src/main/java/com/codingame/gameengine/core/GameManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,13 @@ public final void putMetadata(String key, String value) {
371371
*
372372
* @param frameDuration
373373
* The frame duration in milliseconds.
374+
* @throws IllegalArgumentException
375+
* if frameDuration <= 0
374376
*/
375377
public void setFrameDuration(int frameDuration) {
376-
if (this.frameDuration != frameDuration) {
378+
if (frameDuration <= 0) {
379+
throw new IllegalArgumentException("Invalid frame duration: only positive frame duration is supported");
380+
} else if (this.frameDuration != frameDuration) {
377381
this.frameDuration = frameDuration;
378382
currentViewData.addProperty("duration", frameDuration);
379383
}

playground/misc/misc-3-release-notes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
77
### 🐞 Bug fix
88

99
- Improved display of player output in local test page.
10-
- Better handling of errors from initializing modules
10+
- Better handling of errors from initializing modules.
11+
- `setFrameDuration()` now throws an exception on non-positive values.
1112

1213
## 3.3.1
1314

0 commit comments

Comments
 (0)