From 4f34d1b5d1ac09b469e9af4e00c2ac170aa4e250 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 24 Nov 2019 01:30:19 +0000 Subject: [PATCH] Fixes #232 dont allow negative brush radius --- .../src/main/java/com/sk89q/worldedit/WorldEdit.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java index c44294f0d..d9fdb2c5e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit; +import static com.google.common.base.Preconditions.checkArgument; import static com.sk89q.worldedit.event.platform.Interaction.HIT; import static com.sk89q.worldedit.event.platform.Interaction.OPEN; @@ -408,8 +409,9 @@ public final class WorldEdit { } public void checkMaxBrushRadius(Expression radius) throws MaxBrushRadiusException { + double val = radius.evaluate(); + checkArgument(val >= 0); if (getConfiguration().maxBrushRadius > 0) { - double val = radius.evaluate(); if (val > getConfiguration().maxBrushRadius) { throw new MaxBrushRadiusException(); }