From 6f5cb7a9babdf57f5eae54fb468773857f48ecdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Tue, 10 Nov 2020 15:33:46 +0100 Subject: copy assignment return when this == &other --- labb4/GameState.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'labb4/GameState.cpp') diff --git a/labb4/GameState.cpp b/labb4/GameState.cpp index a21e49c..120e91a 100644 --- a/labb4/GameState.cpp +++ b/labb4/GameState.cpp @@ -35,6 +35,7 @@ GameState::~GameState() { } GameState& GameState::operator=(const GameState& other) { + if (this == &other) return *this; for (const auto& robot : robots) { delete robot; } -- cgit v1.2.1