Open callumreillyy opened 1 month ago
Hey, I had this issue when I did the mini-games. Probs not the best fix but if you look at the end and begin dialogue method in NPC factory I just initialise it again where it fails. It might have even fixed your issue now. But might have a look into preserving the instance when it changes screens in sprint 3
Description
Discovered a bug where exiting combat while being collided with a Friendly npc causes the game to crash. Bug only occurs if player is colliding with a friendly NPC IMMEDIATELY after leaving combat. This is related to the dialogue box variable "chatOverlayService" being null when returning to old screen.
Replicate Bug
Expected Behaviour
A clear and concise description of what you expected to happen.
Error Message
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.csse3200.game.entities.EntityChatService.disposeCurrentOverlay()" because "chatOverlayService" is null
Additional Context
I believe the bug exists due to logic with game screen states, namely the use of "setOldScreen(screen, container)" after combat win which likely does not load the "chatOverlayService" variable correctly when returning to the original game screen.
Interestingly, as long as you are not colliding with a friendly NPC immediately after combat, the bug does not occur. (i.e if you called with enemy away from FNPC, then walk over to an FNPC dialogue loads as normal with no crashes). This could mean it is simply an issue with not loading the resources in the correct order.
Temporary Fix
No temp fix as of right now