v0.6.2a: added safety checks to some usages of curItem
This commit is contained in:
+7
@@ -73,6 +73,13 @@ public abstract class InventoryScroll extends Scroll {
|
|||||||
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
|
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSelect( Item item ) {
|
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) {
|
if (item != null) {
|
||||||
|
|
||||||
((InventoryScroll)curItem).onItemSelected( item );
|
((InventoryScroll)curItem).onItemSelected( item );
|
||||||
|
|||||||
+7
@@ -75,6 +75,13 @@ public abstract class InventoryStone extends Runestone {
|
|||||||
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
|
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSelect( Item item ) {
|
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) {
|
if (item != null) {
|
||||||
|
|
||||||
((InventoryStone)curItem).onItemSelected( item );
|
((InventoryStone)curItem).onItemSelected( item );
|
||||||
|
|||||||
@@ -347,8 +347,15 @@ public abstract class Wand extends Item {
|
|||||||
public void onSelect( Integer target ) {
|
public void onSelect( Integer target ) {
|
||||||
|
|
||||||
if (target != null) {
|
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);
|
final Ballistica shot = new Ballistica( curUser.pos, target, curWand.collisionProperties);
|
||||||
int cell = shot.collisionPos;
|
int cell = shot.collisionPos;
|
||||||
|
|||||||
Reference in New Issue
Block a user