From a58110986d399beb81bdf4fd49c647b0743df201 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Mon, 9 Jun 2025 14:16:14 -0700 Subject: [PATCH] Fix clang-tidy bugprone-unhandled-self-assignment warnings in headers --- src/EventHandler.h | 2 ++ src/UID.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/EventHandler.h b/src/EventHandler.h index 5f8472b2ce..775fd90408 100644 --- a/src/EventHandler.h +++ b/src/EventHandler.h @@ -104,6 +104,8 @@ public: return *this; } const EventHandlerPtr& operator=(const EventHandlerPtr& h) { + if ( this == &h ) + return *this; handler = h.handler; return *this; } diff --git a/src/UID.h b/src/UID.h index aeccc03684..a951432ebe 100644 --- a/src/UID.h +++ b/src/UID.h @@ -85,6 +85,9 @@ inline UID::UID(const UID& other) { } inline UID& UID::operator=(const UID& other) { + if ( this == &other ) + return *this; + memmove(uid, other.uid, sizeof(uid)); initialized = other.initialized; return *this;