Can't attach object to hand

I’m trying to put an object in my main cahacter’s hand. This is a guy seen in 3rd person. I load an animated model from Blender using the Ogre exporter. All animations work like a charm. However this code throws a null pointer exception:

		
SkeletonControl sc;
Skeleton s = animControl.getSkeleton();
sc = new SkeletonControl(s);
Node right_hand = sc.getAttachmentsNode("hand.r");

I can’t seem to get the node describing the right hands bone location. It’s not a problem with this bone specifically, this works fine (in the same function):


...
channel_top.addBone("hand.r");
...
@pebkac said:
		
SkeletonControl sc;
Skeleton s = animControl.getSkeleton();
sc = new SkeletonControl(s);
Node right_hand = sc.getAttachmentsNode("hand.r");
Why do you create a skeleton control yourself? you need to get the SkeletonControl from the model, the same way you got your AnimControl. Also, what line in that code throws the NPE?