From 6dc8d24aa7d03825151fd8f3100dcadbc6187586 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 15 Oct 2013 09:49:28 -0600 Subject: [PATCH] In DB interface, check if callback is None before calling it. --- direct/src/distributed/AstronDatabaseInterface.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/direct/src/distributed/AstronDatabaseInterface.py b/direct/src/distributed/AstronDatabaseInterface.py index c8eac1096b..de657f24e7 100644 --- a/direct/src/distributed/AstronDatabaseInterface.py +++ b/direct/src/distributed/AstronDatabaseInterface.py @@ -68,7 +68,8 @@ class AstronDatabaseInterface: ' (ctx %d, doId %d)' % (ctx, doId)) return - self._callbacks[ctx](doId) + if self._callbacks[ctx]: + self._callbacks[ctx](doId) del self._callbacks[ctx] self.air.contextAllocator.free(ctx) @@ -104,7 +105,8 @@ class AstronDatabaseInterface: try: if not success: - self._callbacks[ctx](None, None) + if self._callbacks[ctx]: + self._callbacks[ctx](None, None) return dclassId = di.getUint16() @@ -131,7 +133,8 @@ class AstronDatabaseInterface: fields[field.getName()] = field.unpackArgs(unpacker) unpacker.endUnpack() - self._callbacks[ctx](dclass, fields) + if self._callbacks[ctx]: + self._callbacks[ctx](dclass, fields) finally: del self._callbacks[ctx]