tobexyz / yaacc-code

YAACC - UPNP Client and Server
Other
101 stars 14 forks source link

Runtime crash on each startup #27

Closed spaetz closed 5 years ago

spaetz commented 5 years ago

YAAC currently causes a crash on startup, logging java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Collection de.yaacc.player.PlayerService.getCurrentPlayers()' on a null object reference

and indeed, in getCurrentPlayers, there is no protection against currentActivePlayer being null. The function getPlayer has the following:

if (currentActivePlayer.get(playerId) == null){ Log.d(this.getClass().getName(), "Get Player not found"); }

and I guess something like this might also be needed for getCurrentPlayers. Sorry for not providing a pull request, I have not been able to build YAACC yet.

tobexyz commented 5 years ago

Thank you for reporting the bug. I think it has to be fixed in the UpnpClient. The playerservice member seems to be null if the service isn't bound fast enough and there is no null check yet when accessing the member

tobexyz commented 5 years ago

fixed with version 2.3.0