Skip to content

Commit c7a534c

Browse files
fix: adjust infinite loop protection in workAcrossWorlds (#2113)
1 parent d070979 commit c7a534c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/src/layer/shared/feature_layer_utils.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,14 @@ mixin FeatureLayerUtils on CustomPainter {
6363
const maxShiftsCount = 30;
6464
int shiftsCount = 0;
6565

66+
final worldWidth = this.worldWidth;
67+
6668
void protectInfiniteLoop() {
67-
if (++shiftsCount > maxShiftsCount) throw const StackOverflowError();
69+
if (++shiftsCount > maxShiftsCount) {
70+
throw AssertionError(
71+
'Infinite loop going beyond $maxShiftsCount for world width $worldWidth',
72+
);
73+
}
6874
}
6975

7076
protectInfiniteLoop();

0 commit comments

Comments
 (0)