summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/kernel/qobject.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 143dbff..9ce111d 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2298,13 +2298,12 @@ QObject *QObject::sender() const
if (!d->currentSender)
return 0;
- // Return 0 if d->currentSender isn't in d->senders
- bool found = false;
- for (QObjectPrivate::Connection *c = d->senders; c && !found; c = c->next)
- found = (c->sender == d->currentSender->sender);
- if (!found)
- return 0;
- return d->currentSender->sender;
+ for (QObjectPrivate::Connection *c = d->senders; c; c = c->next) {
+ if (c->sender == d->currentSender->sender)
+ return d->currentSender->sender;
+ }
+
+ return 0;
}
/*!