fix(network): prevent null multiplayer peer crashes offline/teardown and fix Nakama RPC session validation
This commit is contained in:
@@ -93,8 +93,14 @@ func api_rpc_async(rpc_id: String, payload: String = "{}") -> Dictionary:
|
||||
|
||||
var retries := 0
|
||||
while retries <= MAX_RETRIES:
|
||||
if not nakama_backend or not nakama_backend.client or not nakama_backend.session:
|
||||
return { "success": false, "error": ErrorCode.UNAUTHORIZED, "message": "Not authenticated" }
|
||||
|
||||
var result = await nakama_backend.client.rpc_async(nakama_backend.session, rpc_id, payload)
|
||||
|
||||
if result == null:
|
||||
return { "success": false, "error": ErrorCode.INTERNAL_ERROR, "message": "RPC call returned null" }
|
||||
|
||||
# NakamaAPI.ApiRpc has is_exception()
|
||||
if result.is_exception():
|
||||
var ex = result.get_exception()
|
||||
|
||||
Reference in New Issue
Block a user