|  | 
 
  
    | 
      
        |  Author | Topic: loadImage file-not-found trap missed  (Read 278 times) |  |  
  
    | 
      
        | 
          
            | battey 
 
   
 | 
              
                | loadImage file-not-found trap missed «  on: Nov 15th, 2003, 4:13am »
 |  |  alpha 67
 
 This code generates an error, as one would expect, since the target file isn't around:
 
 Code:
 | | BImage b = loadImage("notThere.jpg");
 
 | 
 | 
 
 The following code returns a NullPointerException (as does any code that tries to access the BImage object, as far as I can tell). Unfortunately, if one isn't aware that one's loadImage is pointing at a non-entity, one could spend a terrible amount of time trying to figure out what else in one's code is generating the Exception!
 
 Code:
 | | BImage b = loadImage("notThere.jpg");
 int c=b.pixels[3];
 
 | 
 | 
 |  
            |  |  |  |  
  
    | 
      
        | 
          
            | fry 
 
 
   
 | 
              
                | Re: loadImage file-not-found trap missed « Reply #1 on: Nov 23rd, 2003, 11:45pm »
 |  |  but doesn't it give you the loadImage error first?
 |  
            |  |  |  |  
 |