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;
|
||||
public override bool Matches(GameObject gameObject, UsableItem usableItem) {
|
||||
bool rv = base.Matches(gameObject, usableItem);
|
||||
if(rv) {
|
||||
crop = ((FarmlandTile)gameObject.GetComponent<TileBehaviour>().Tile).Crop;
|
||||
rv = (_tile.GetType() == typeof(FarmlandTile));
|
||||
try {
|
||||
crop = ((FarmlandTile)_tile).Crop;
|
||||
}
|
||||
catch {
|
||||
rv = false;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue