From bcad2b08761c8242a15e4399152b68b4dfcb8b7d Mon Sep 17 00:00:00 2001
From: Edvard <edvardee@stud.ntnu.no>
Date: Mon, 20 May 2024 17:56:00 +0200
Subject: [PATCH] Fix minor bug with setMaxMinCoords method

---
 .idea/vcs.xml                                               | 6 ++++++
 .../example/chaosgame/controller/ChaosGameController.java   | 3 ++-
 .../example/chaosgame/model/chaos/ChaosGameDescription.java | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 .idea/vcs.xml

diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/src/main/java/org/example/chaosgame/controller/ChaosGameController.java b/src/main/java/org/example/chaosgame/controller/ChaosGameController.java
index cb8678b..0aaeedb 100644
--- a/src/main/java/org/example/chaosgame/controller/ChaosGameController.java
+++ b/src/main/java/org/example/chaosgame/controller/ChaosGameController.java
@@ -148,7 +148,8 @@ public class ChaosGameController implements Observer, Subject, GameController {
                 Double.parseDouble(coords.get(3)));
 
         updateChaosGame(new ChaosGameDescription(min, max,
-                chaosGame.getDescription().getTransforms()));
+                chaosGame.getDescription().getTransforms(),
+                chaosGame.getDescription().getProbabilities()));
       } catch (NumberFormatException e) {
         AlertUtility.showErrorDialog("Invalid input",
                 "Please enter a valid number.");
diff --git a/src/main/java/org/example/chaosgame/model/chaos/ChaosGameDescription.java b/src/main/java/org/example/chaosgame/model/chaos/ChaosGameDescription.java
index 8c7177f..cd4056a 100644
--- a/src/main/java/org/example/chaosgame/model/chaos/ChaosGameDescription.java
+++ b/src/main/java/org/example/chaosgame/model/chaos/ChaosGameDescription.java
@@ -53,7 +53,7 @@ public class ChaosGameDescription {
           throws IllegalArgumentException {
     validateCoordinates(minCoords, maxCoords);
     validateTransforms(transforms);
-    if (probabilities.size() != transforms.size()) {
+    if (probabilities != null && probabilities.size() != transforms.size()) {
       throw new IllegalArgumentException("Probabilities must match the number of transformations");
     }
     this.minCoords = minCoords;
-- 
GitLab