Check arguments against None in objreg.
This commit is contained in:
parent
895f51083d
commit
75ba75a0d7
@ -58,6 +58,11 @@ class ObjectRegistry(collections.UserDict):
|
||||
|
||||
Sets a slot to remove QObjects when they are destroyed.
|
||||
"""
|
||||
if name is None:
|
||||
raise TypeError("Registering '{}' with name 'None'!".format(obj))
|
||||
if obj is None:
|
||||
raise TypeError("Registering object None with name '{}'!".format(
|
||||
name))
|
||||
if isinstance(obj, QObject):
|
||||
obj.destroyed.connect(functools.partial(self.on_destroyed, name))
|
||||
super().__setitem__(name, obj)
|
||||
|
Loading…
Reference in New Issue
Block a user