@@ -143,25 +143,31 @@ public void run() {
143143 }.start ();
144144
145145 String gitRepoStr = t .getScripting ().getGitRepo ();
146- String [] split = gitRepoStr .split ("\\ ." );
147- String string = split [split .length - 2 ];
148- String [] url = string .split ("/" );
149- String slug = url [url .length - 2 ] + "/" + url [url .length - 1 ];
150- String key = slug + ":" + t .getScripting ().getGitFile ();
151- com .neuronrobotics .sdk .common .Log .debug ("Loading local file from: " + file .getAbsolutePath () + "\n " + key );
152-
153- if (key .length () == 1 )
154- throw new RuntimeException ("Failed to create a file key" );
155- ArrayList <String > files = new ArrayList <>();
156- files .add (gitRepoStr );
157- files .add (t .getScripting ().getGitFile ());
158- try {
159- if (key .length () > 3 && files .get (0 ).length () > 0 && files .get (1 ).length () > 0 ) {// catch degenerates
160- ConfigurationDatabase .setObject ("studio-open-file" , key , files );
161- ConfigurationDatabase .save ();
146+ String key = null ;
147+ if (gitRepoStr != null ) {
148+ String [] split = gitRepoStr .split ("\\ ." );
149+ String string = split [split .length - 2 ];
150+ String [] url = string .split ("/" );
151+ String slug = url [url .length - 2 ] + "/" + url [url .length - 1 ];
152+ key = slug + ":" + t .getScripting ().getGitFile ();
153+ com .neuronrobotics .sdk .common .Log
154+ .debug ("Loading local file from: " + file .getAbsolutePath () + "\n " + key );
155+
156+ if (key .length () == 1 )
157+ throw new RuntimeException ("Failed to create a file key" );
158+ ArrayList <String > files = new ArrayList <>();
159+ files .add (gitRepoStr );
160+
161+ files .add (t .getScripting ().getGitFile ());
162+ try {
163+ if (key .length () > 3 && files .get (0 ).length () > 0 && files .get (1 ).length () > 0 ) {// catch
164+ // degenerates
165+ ConfigurationDatabase .setObject ("studio-open-file" , key , files );
166+ ConfigurationDatabase .save ();
167+ }
168+ } catch (java .lang .NullPointerException ex ) {
169+ // file can not be opened
162170 }
163- } catch (java .lang .NullPointerException ex ) {
164- // file can not be opened
165171 }
166172
167173 fileTab .setContent (t );
@@ -179,11 +185,12 @@ public void run() {
179185 addTab (fileTab , true );
180186 widgets .put (file .getAbsolutePath (), t );
181187 System .err .println ("Open Tab " + file .getAbsolutePath ());
182-
188+ String myKey = key ;
183189 fileTab .setOnCloseRequest (event -> {
184190 widgets .remove (file .getAbsolutePath ());
185191 openFiles .remove (file .getAbsolutePath ());
186- ConfigurationDatabase .removeObject ("studio-open-file" , key );
192+ if (myKey != null )
193+ ConfigurationDatabase .removeObject ("studio-open-file" , myKey );
187194 ConfigurationDatabase .save ();
188195 t .getScripting ().close ();
189196 Log .debug ("Closing Tab Here " + file .getAbsolutePath ());
0 commit comments