File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed 
wpilibj/src/main/java/edu/wpi/first/wpilibj Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -382,8 +382,15 @@ private static <T extends RobotBase> void runRobot(Supplier<T> robotSupplier) {
382382      }
383383      String  robotName  = "Unknown" ;
384384      StackTraceElement [] elements  = throwable .getStackTrace ();
385-       if  (elements .length  > 0 ) {
386-         robotName  = elements [0 ].getClassName ();
385+       for  (var  element  : elements ) {
386+         try  {
387+           if  (RobotBase .class .isAssignableFrom (Class .forName (element .getClassName ()))) {
388+             robotName  = element .getClassName ();
389+             break ;
390+           }
391+         } catch  (ClassNotFoundException  e ) {
392+           // The class is in the stack trace, it better exist 
393+         }
387394      }
388395      DriverStation .reportError (
389396          "Unhandled exception instantiating robot "  + robotName  + " "  + throwable , elements );
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments