diff --git a/src/nimqml/private/qobject.nim b/src/nimqml/private/qobject.nim index 02565d1..0c5ecec 100644 --- a/src/nimqml/private/qobject.nim +++ b/src/nimqml/private/qobject.nim @@ -23,6 +23,9 @@ method metaObject*(self: QObject): QMetaObject {.base.} = QObject.staticMetaObject proc emit*(qobject: QObject, signalName: string, arguments: openarray[QVariant] = []) = + if qobject.vptr.isNil: + return + ## Emit the signal with the given name and values var dosArguments: seq[DosQVariant] = @[] for argument in arguments: @@ -73,4 +76,4 @@ proc vptr*(self: QObject): DosQObject = result = self.vptr proc signalConnect*(sender: QObject, signal: string, receiver: QObject, slot: string, signalType: int = 0) = - dos_qobject_signal_connect(sender.vptr, ("2" & signal).cstring, receiver.vptr, ("1" & slot).cstring, signalType.cint) \ No newline at end of file + dos_qobject_signal_connect(sender.vptr, ("2" & signal).cstring, receiver.vptr, ("1" & slot).cstring, signalType.cint)