From 447400668ed7d4758b3b3835bc6afc3e735ef142 Mon Sep 17 00:00:00 2001 From: silverqx Date: Wed, 17 Aug 2022 15:15:09 +0200 Subject: [PATCH] added asserts to type.cpp --- src/orm/utils/type.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/orm/utils/type.cpp b/src/orm/utils/type.cpp index 6f703af9b..12ed6cf71 100644 --- a/src/orm/utils/type.cpp +++ b/src/orm/utils/type.cpp @@ -46,6 +46,9 @@ QString Type::prettyFunction(const QString &function) "Unsupported compiler in Utils::Type::prettyFunction()."); #endif + Q_ASSERT_X(!function.isEmpty(), "empty string", + "The function name can't be empty in Utils::Type::prettyFunction()."); + const auto match = regex.match(function); // This should never happen, but who knows 🤔 @@ -118,6 +121,9 @@ Type::classPureBasenameInternal(const char *typeName, const bool withNamespace) QString Type::classPureBasenameMsvc(const QString &className, const bool withNamespace) { + Q_ASSERT_X(!className.isEmpty(), "empty string", + "The class name can't be empty in Utils::Type::classPureBasenameMsvc()."); + auto findBeginWithoutNS = [&className] { return className.indexOf(SPACE) + 1; @@ -158,6 +164,9 @@ Type::classPureBasenameMsvc(const QString &className, const bool withNamespace) QString Type::classPureBasenameGcc(const QString &className, const bool withNamespace) { + Q_ASSERT_X(!className.isEmpty(), "empty string", + "The class name can't be empty in Utils::Type::classPureBasenameGcc()."); + // Find the beginning of the class name const auto *itBegin = className.cbegin();