Skip to content

Commit a96f4c7

Browse files
committed
Bugfix: Throw error when child model file does not exist
1 parent 39dcdc5 commit a96f4c7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/GUIChildModel.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ package org.nlogo.ls
33
import java.awt._
44
import java.awt.event.{ WindowAdapter, WindowEvent }
55
import javax.swing.{ JFrame, JMenuBar, WindowConstants }
6-
import java.io.IOException
6+
import java.io.{ FileNotFoundException, IOException }
7+
import java.nio.file.{ Files, Paths }
78

89
import org.nlogo.api._
910
import org.nlogo.app.{ App, ZoomMenu }
@@ -19,6 +20,10 @@ class GUIChildModel @throws(classOf[InterruptedException]) @throws(classOf[Exten
1920
(ls: LevelSpace, parentWorkspace: Workspace, path: String, modelID: Int)
2021
extends ChildModel(parentWorkspace, modelID) {
2122

23+
if (!Files.exists(Paths.get(path))) {
24+
throw new FileNotFoundException(path)
25+
}
26+
2227
val (component, panel, frame) = UnlockAndBlock.onEDT(parentWorkspace.world) {
2328
val f = new JFrame with NetLogoIcon with ModalProgress
2429
val component: InterfaceComponent = new ZoomableInterfaceComponent(f)

0 commit comments

Comments
 (0)