aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-07-30 07:37:15 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-07-30 07:37:15 +0200
commitd4b8f54f764bec5758c8f672d4ab05d59e02c269 (patch)
tree5659a82feb56b780bd93616ba79dfd4d3063fe03 /lib
parent953d5a9d03b2a3ca439a79775a0c212965d91c20 (diff)
downloadlibquotient-d4b8f54f764bec5758c8f672d4ab05d59e02c269.tar.gz
libquotient-d4b8f54f764bec5758c8f672d4ab05d59e02c269.zip
moving eventCast(): disallow passing nullptr
This is aligned with the non-moving version.
Diffstat (limited to 'lib')
-rw-r--r--lib/events/event.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/events/event.h b/lib/events/event.h
index 043d4f54..b7454337 100644
--- a/lib/events/event.h
+++ b/lib/events/event.h
@@ -343,9 +343,9 @@ template <class EventT, typename BasePtrT>
inline auto eventCast(const BasePtrT& eptr)
-> decltype(static_cast<EventT*>(&*eptr))
{
- Q_ASSERT(eptr);
- return is<std::decay_t<EventT>>(*eptr) ? static_cast<EventT*>(&*eptr)
- : nullptr;
+ return eptr && is<std::decay_t<EventT>>(*eptr)
+ ? static_cast<EventT*>(&*eptr)
+ : nullptr;
}
//! \brief Cast the event pointer down in a type-safe way, with moving