File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/main/java/org/algorithm_visualizer Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1313import java .io .InputStreamReader ;
1414import java .io .Writer ;
1515import java .nio .file .Files ;
16+ import java .nio .file .Path ;
1617import java .nio .file .Paths ;
1718import java .util .ArrayList ;
1819import java .util .List ;
@@ -31,8 +32,12 @@ public Response handleRequest(String code, Context context) {
3132 compile (sourceFile );
3233 run (tmpDir );
3334
34- String commands = new String (Files .readAllBytes (Paths .get (tmpDir .toString (), "visualization.json" )));
35+ Path visualizationPath = Paths .get (tmpDir .toString (), "visualization.json" );
36+ if (!visualizationPath .toFile ().exists ())
37+ throw new Exception ("Visualization Not Found" );
38+ String commands = new String (Files .readAllBytes (visualizationPath ));
3539 return new Response (commands );
40+
3641 } catch (Exception e ) {
3742 return new Response (e );
3843 }
You can’t perform that action at this time.
0 commit comments