v0.6.2a: added safety checks to some usages of curItem
This commit is contained in:
@@ -73,6 +73,13 @@ public abstract class InventoryScroll extends Scroll {
|
||||
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
|
||||
//FIXME this safety check shouldn't be necessary
|
||||
//it would be better to eliminate the curItem static variable.
|
||||
if (!(curItem instanceof InventoryScroll)){
|
||||
return;
|
||||
}
|
||||
|
||||
if (item != null) {
|
||||
|
||||
((InventoryScroll)curItem).onItemSelected( item );
|
||||
|
||||
@@ -75,6 +75,13 @@ public abstract class InventoryStone extends Runestone {
|
||||
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
|
||||
//FIXME this safety check shouldn't be necessary
|
||||
//it would be better to eliminate the curItem static variable.
|
||||
if (!(curItem instanceof InventoryStone)){
|
||||
return;
|
||||
}
|
||||
|
||||
if (item != null) {
|
||||
|
||||
((InventoryStone)curItem).onItemSelected( item );
|
||||
|
||||
@@ -347,8 +347,15 @@ public abstract class Wand extends Item {
|
||||
public void onSelect( Integer target ) {
|
||||
|
||||
if (target != null) {
|
||||
|
||||
final Wand curWand = (Wand)Wand.curItem;
|
||||
|
||||
//FIXME this safety check shouldn't be necessary
|
||||
//it would be better to eliminate the curItem static variable.
|
||||
final Wand curWand;
|
||||
if (curItem instanceof Wand) {
|
||||
curWand = (Wand) Wand.curItem;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
final Ballistica shot = new Ballistica( curUser.pos, target, curWand.collisionProperties);
|
||||
int cell = shot.collisionPos;
|
||||
|
||||
Reference in New Issue
Block a user