When i try to create Game room from extension with following settings, SmartFoxServer.getInstance().getAPIManager().getGameApi().createGame throws NullPointerException. Why?
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:964)
at com.smartfoxserver.v2.entities.managers.SFSRoomManager.containsRoom(SFSRoomManager.java:469)
at com.smartfoxserver.v2.entities.managers.SFSRoomManager.validateRoomName(SFSRoomManager.java:700)
at com.smartfoxserver.v2.entities.managers.SFSRoomManager.createRoom(SFSRoomManager.java:92)
at com.smartfoxserver.v2.entities.SFSZone.createRoom(SFSZone.java:272)
at com.smartfoxserver.v2.api.SFSApi.createRoom(SFSApi.java:733)
at com.smartfoxserver.v2.api.SFSGameApi.createGame(SFSGameApi.java:147)
at com.nethertech.zone.StartMatchmakingRequestHandler.performMatchmaking(StartMatchmakingRequestHandler.java:203)
at com.nethertech.zone.StartMatchmakingRequestHandler.handleClientRequest(StartMatchmakingRequestHandler.java:105)
at com.smartfoxserver.v2.extensions.SFSExtension.handleClientRequest(SFSExtension.java:208)
at com.smartfoxserver.v2.controllers.v290.ExtensionReqController.processRequest(ExtensionReqController.java:174)
at com.smartfoxserver.v2.controllers.v290.ExtensionReqController$1.run(ExtensionReqController.java:68)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Hi,
you've forgot the name of the Room. A room with no name can't be created, and this particular case the exception is raised because the server attempts to check if another Room with the same name exists, but the name is null.
We'll add a check at the top of the API call with a clear Exception in the next release.