Skip to content

Commit

Permalink
oops -- didn't add the safety check for a null image in Pick
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanshi committed Dec 6, 2007
1 parent b265c4a commit a56f915
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/powerreader/Pick.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.sun.j3d.utils.image.TextureLoader;
import image.ImageFetcher;
import java.awt.event.MouseAdapter;
import java.awt.image.BufferedImage;
import java.net.MalformedURLException;
import java.net.URL;
import javax.media.j3d.Raster;
Expand Down Expand Up @@ -131,21 +132,24 @@ else if(ConfigurationManager.getFocusLevel() == RawTextParser.LEVEL_DOCUMENT_ID)
// clear out any existing images from the player
Player.removeImages();
ImageFetcher f = ConfigurationManager.getImageFetcher();
TextureLoader imageT = new TextureLoader(f.getImage(pickedText),c3D);
Raster imageObj = new Raster(new Point3f(0, 0,1f),
Raster.RASTER_COLOR, 0, 0, imageT.getImage().getWidth(), imageT.getImage().getHeight(),
imageT.getImage(), null);
Shape3D shape = new Shape3D(imageObj);
imageObj.setCapability(Raster.ALLOW_IMAGE_WRITE);
BranchGroup node = new BranchGroup();
BufferedImage img = f.getImage(pickedText);
if (img != null) {
TextureLoader imageT = new TextureLoader(img,c3D);
Raster imageObj = new Raster(new Point3f(0, 0,1f),
Raster.RASTER_COLOR, 0, 0, imageT.getImage().getWidth(), imageT.getImage().getHeight(),
imageT.getImage(), null);
Shape3D shape = new Shape3D(imageObj);
imageObj.setCapability(Raster.ALLOW_IMAGE_WRITE);
BranchGroup node = new BranchGroup();

node.setCapability(BranchGroup.ALLOW_DETACH);
node.setCapability(BranchGroup.ALLOW_DETACH);

node.addChild(shape);
lastPicked = tObj.getTheTextTransformGroup();
lastPicked.addChild(node);
node.addChild(shape);
lastPicked = tObj.getTheTextTransformGroup();
lastPicked.addChild(node);

lastAttached =node;
lastAttached =node;
}
}
}
// dictionary meaning
Expand Down

0 comments on commit a56f915

Please sign in to comment.