UQcsse3200 / 2024-studio-3

MIT License
6 stars 0 forks source link

Fire extinguisher Interaction Bug #322

Closed StrayIntellectual closed 3 weeks ago

StrayIntellectual commented 1 month ago

Description

Game crashes on interact with fire extinguisher

How To Reproduce

Steps to reproduce the behaviour:

  1. Start game
  2. Walk to Fire extinguisher
  3. Press 'E'
  4. Crash :(

Expected Behaviour

Standard fire extinguisher behaviour expected, pickup etc.

Temporary Fix

Remove fire extinguisher from game, potentially unnecessary bloat.

benjamin-wang1 commented 1 month ago

Fixed in the latest main (#319) Was some missing code to prevent not getting an error if an image does not exist

abhat0 commented 1 month ago

Game crashes on interact with fire extinguisher again

Error message:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.csse3200.game.entities.Entity.getComponent(java.lang.Class)" because "entity" is null
    at com.csse3200.game.components.items.ItemTexturePathGetter.getTexturePath(ItemTexturePathGetter.java:35)
    at com.csse3200.game.components.items.ItemComponent.getTexturePath(ItemComponent.java:62)
    at com.csse3200.game.components.player.InventoryDisplay.updateDisplay(InventoryDisplay.java:128)
    at com.csse3200.game.components.player.InventoryDisplay.update(InventoryDisplay.java:149)
    at com.csse3200.game.events.EventHandler.lambda$trigger$0(EventHandler.java:96)
    at java.base/java.lang.Iterable.forEach(Iterable.java:75)
    at com.csse3200.game.events.EventHandler.forEachListener(EventHandler.java:325)
    at com.csse3200.game.events.EventHandler.trigger(EventHandler.java:96)
    at com.csse3200.game.components.player.InventoryComponent.addItem(InventoryComponent.java:218)
    at com.csse3200.game.components.station.FireExtinguisherHandlerComponent.giveExtinguisher(FireExtinguisherHandlerComponent.java:105)
    at com.csse3200.game.components.station.FireExtinguisherHandlerComponent.givePutExtinguisher(FireExtinguisherHandlerComponent.java:79)
    at com.csse3200.game.components.station.FireExtinguisherHandlerComponent.handleFireExtinguisher(FireExtinguisherHandlerComponent.java:36)
    at com.csse3200.game.components.player.PlayerActions.interact(PlayerActions.java:99)