From 3f9f9bf9f8fa8cc453c6a1539c3e31140c094ae7 Mon Sep 17 00:00:00 2001 From: Sam V Date: Tue, 30 Nov 2021 00:20:27 +0100 Subject: [PATCH] Enable readability-delete-null-pointer clang-tidy check, fix occurrences #66 --- .clang-tidy | 2 +- cl_dll/vgui_CustomObjects.cpp | 3 +-- dlls/world.cpp | 5 +---- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 62c7944..05376f5 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,4 @@ -Checks: '-*,readability-implicit-bool-conversion' +Checks: '-*,readability-delete-null-pointer,readability-implicit-bool-conversion' CheckOptions: - key: readability-implicit-bool-conversion.AllowPointerConditions value: '1' diff --git a/cl_dll/vgui_CustomObjects.cpp b/cl_dll/vgui_CustomObjects.cpp index 7204478..dd356a3 100644 --- a/cl_dll/vgui_CustomObjects.cpp +++ b/cl_dll/vgui_CustomObjects.cpp @@ -373,8 +373,7 @@ int CImageLabel::getImageTall() void CImageLabel::LoadImage(const char* pImageName) { - if (m_pTGA) - delete m_pTGA; + delete m_pTGA; // Load the Image m_pTGA = LoadTGAForRes(pImageName); diff --git a/dlls/world.cpp b/dlls/world.cpp index 24e5cc7..9e2b131 100644 --- a/dlls/world.cpp +++ b/dlls/world.cpp @@ -493,10 +493,7 @@ void CWorld::Precache() CVAR_SET_STRING("room_type", "0"); // clear DSP // Set up game rules - if (g_pGameRules) - { - delete g_pGameRules; - } + delete g_pGameRules; g_pGameRules = InstallGameRules();