diff --git a/src/control/control.cpp b/src/control/control.cpp index d7d4db46d60..a19680e2a70 100644 --- a/src/control/control.cpp +++ b/src/control/control.cpp @@ -134,9 +134,11 @@ QSharedPointer ControlDoublePrivate::getControl( bool bPersist, double defaultValue) { if (!key.isValid()) { - qWarning() << "ControlDoublePrivate::getControl returning nullptr" - << "for invalid ConfigKey" << key; - DEBUG_ASSERT(flags.testFlag(ControlFlag::AllowInvalidKey)); + if (!flags.testFlag(ControlFlag::AllowInvalidKey)) { + qWarning() << "ControlDoublePrivate::getControl returning nullptr" + << "for invalid ConfigKey" << key; + DEBUG_ASSERT(!"Unexpected invalid key"); + } return nullptr; }