fixed nullptrexception
This commit is contained in:
parent
5433305b14
commit
51ab23d3e1
1 changed files with 5 additions and 3 deletions
|
|
@ -35,9 +35,11 @@ namespace Assets.Scripts.Actions {
|
||||||
protected Crop crop;
|
protected Crop crop;
|
||||||
public override bool Matches(GameObject gameObject, UsableItem usableItem) {
|
public override bool Matches(GameObject gameObject, UsableItem usableItem) {
|
||||||
bool rv = base.Matches(gameObject, usableItem);
|
bool rv = base.Matches(gameObject, usableItem);
|
||||||
if(rv) {
|
try {
|
||||||
crop = ((FarmlandTile)gameObject.GetComponent<TileBehaviour>().Tile).Crop;
|
crop = ((FarmlandTile)_tile).Crop;
|
||||||
rv = (_tile.GetType() == typeof(FarmlandTile));
|
}
|
||||||
|
catch {
|
||||||
|
rv = false;
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue