From 30f1f02cf74617bb53a4aa997c1e8d05e98e5f5d Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 17 Jun 2021 07:47:13 +0200 Subject: [PATCH] codechecker: Add assert for implicit condition Since memReq is initialized inside the loop, codechecker complained that we might use uninitialized data if count == 0. So we assert that this is not the case to get rid of the warning. Change-Id: I82152942d2bb61723e9e41489c87bfde9f8bec15 Reviewed-by: Laszlo Agocs --- src/gui/vulkan/qvulkanwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp index 32a1d76748..c57f3bf372 100644 --- a/src/gui/vulkan/qvulkanwindow.cpp +++ b/src/gui/vulkan/qvulkanwindow.cpp @@ -1330,6 +1330,7 @@ bool QVulkanWindowPrivate::createTransientImage(VkFormat format, VkMemoryRequirements memReq; VkResult err; + Q_ASSERT(count > 0); for (int i = 0; i < count; ++i) { VkImageCreateInfo imgInfo; memset(&imgInfo, 0, sizeof(imgInfo));