2015-12-24 42 views
0

我需要一些SmartFox服務器的幫助,請。SmartFox錯誤NullPointerException在SFSGameApi.populateInvitations

ISFSGameApi gameAPI = SmartFoxServer.getInstance().getAPIManager().getGameApi(); 
     List<User> invitees = new ArrayList<User>(); 
     invitees.add(invitee); 

     CreateSFSGameSettings settings = new CreateSFSGameSettings(); 
     settings.setMaxUsers(2); 
     settings.setMaxVariablesAllowed(5); 
     settings.setGame(true); 
     settings.setInvitationExpiryTime(waitingTime); 
     settings.setMinPlayersToStartGame(2); 
     settings.setName("rm-" + sender.getName()); 
     settings.setDynamic(true); 
     settings.setLeaveLastJoinedRoom(false); 
     settings.setAutoRemoveMode(SFSRoomRemoveMode.WHEN_EMPTY); 
     settings.setInvitedPlayers(invitees); 

     try { 
     gameAPI.createGame(getParentExtension().getParentZone(), settings, sender); 
     } catch (SFSCreateRoomException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 

我在執行上述代碼作爲擴展時遇到此錯誤。任何想法是讚賞。我不太熟悉java。謝謝

java.lang.NullPointerException: 
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
Exception: java.lang.NullPointerException 
Message: *** Null *** 
Description: Error while handling client request in extension: { Ext: QyServerExtension, Type: JAVA, Lev: ZONE, { Zone: Qy }, {} } 
Extension Cmd: invite 
+--- --- ---+ 
Stack Trace: 
+--- --- ---+ 
com.smartfoxserver.v2.api.SFSGameApi.populateInvitations(SFSGameApi.java:374) 
com.smartfoxserver.v2.api.SFSGameApi.createGame(SFSGameApi.java:153) 
com.smartfoxserver.v2.api.SFSGameApi.createGame(SFSGameApi.java:83) 
qy.server.GameInvitation.handleClientRequest(GameInvitation.java:56) 
com.smartfoxserver.v2.extensions.SFSExtension.handleClientRequest(SFSExtension.java:208) 
com.smartfoxserver.v2.controllers.v290.ExtensionReqController.processRequest(ExtensionReqController.java:174) 
com.smartfoxserver.v2.controllers.v290.ExtensionReqController$1.run(ExtensionReqController.java:68) 
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
java.lang.Thread.run(Unknown Source) 
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 

我的猜測是有事情做與邀請函,我跟蹤的「被邀請者」和它的用戶,還跟蹤其他VAR和工作確定。

回答

0

改變

settings.setMinPlayersToStartGame(2); 

settings.setMinPlayersToStartGame(1); 

,它工作正常。還是很奇怪。我猜。希望它有助於某人。