@@ -48,7 +48,16 @@ private TargetHandler()
4848
4949 static
5050 {
51- load ();
51+ try
52+ {
53+ load ();
54+ }
55+ catch (Throwable e )
56+ {
57+ // keep the plugin in a usable state even if this
58+ // happens to fail to find any target compilers
59+ EnigmaRunner .showDefaultExceptionHandler (e );
60+ }
5261 }
5362
5463 public static void load ()
@@ -271,30 +280,46 @@ private static ArrayList<TargetSelection> findCompilers()
271280 {
272281 String ey = file .getName ();
273282 if (!ey .endsWith (".ey" )) continue ; //$NON-NLS-1$
283+ TargetSelection ps = null ;
274284 try
275285 {
276286 YamlNode node = YamlParser .parse (file );
277- YamlNode exeVarsNode = (YamlNode ) node .getM ("EXE-Vars" );
278-
279- TargetSelection ps = new TargetSelection ();
287+ ps = new TargetSelection ();
280288 ps .id = ey .substring (0 ,ey .length () - 3 );
281289 ps .name = node .getMC ("Name" ); //$NON-NLS-1$
282290 ps .desc = node .getMC ("Description" ,null ); //$NON-NLS-1$
283291 ps .auth = node .getMC ("Maintainer" ,null ); //$NON-NLS-1$
284- ps .ext = exeVarsNode .getMC ("Build-Extension" ,null ); //$NON-NLS-1$
285- ps .outputexe = exeVarsNode .getMC ("Run-output" ,null ); //$NON-NLS-1$
286292 ps .depends = new HashMap <String ,Set <String >>();
287293 Set <String > target = new HashSet <String >();
288294 String targplat = node .getMC ("Target-platform" ,null ); //$NON-NLS-1$
289295 if (target != null ) targplat = normalize (targplat );
290296 target .add (targplat );
291297 ps .depends .put ("target" ,target ); //$NON-NLS-1$
292298 if (node .getBool ("Native" ,false )) defCompiler = ps ; //$NON-NLS-1$
293- tCompilers .add (ps );
299+ try
300+ {
301+ YamlNode exeVarsNode = (YamlNode ) node .getM ("EXE-Vars" ); //$NON-NLS-1$
302+ ps .ext = exeVarsNode .getMC ("Build-Extension" ,null ); //$NON-NLS-1$
303+ ps .outputexe = exeVarsNode .getMC ("Run-output" ,null ); //$NON-NLS-1$
304+ }
305+ catch (IndexOutOfBoundsException e )
306+ {
307+ // there was no "EXE-Vars" key, which is optional
308+ // but still check under the old location
309+ ps .ext = node .getMC ("Build-Extension" ,null ); //$NON-NLS-1$
310+ ps .outputexe = node .getMC ("Run-output" ,null ); //$NON-NLS-1$
311+ }
312+
313+ // only add the target if there were no errors
314+ if (ps != null ) tCompilers .add (ps );
294315 }
295316 catch (FileNotFoundException e )
296317 {
297318 }
319+ catch (Exception e )
320+ {
321+ EnigmaRunner .showDefaultExceptionHandler (e );
322+ }
298323 }
299324 return tCompilers ;
300325 }
0 commit comments