summaryrefslogtreecommitdiff
path: root/cpp/poppler-image.cpp
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2019-11-29 14:42:31 +0100
committerAlbert Astals Cid <aacid@kde.org>2019-11-29 14:43:26 +0100
commitec2b036e0029e94183a87471c83577336bbaedda (patch)
tree3c2846c382a791fe9e42a54bbe303fd509b6c5b2 /cpp/poppler-image.cpp
parent98dbe4becbebb96dc46a581dad338e84d747334e (diff)
Return early in operator= if we're assigning to ourselves
Makes bugprone-unhandled-self-assignment happy
Diffstat (limited to 'cpp/poppler-image.cpp')
-rw-r--r--cpp/poppler-image.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/cpp/poppler-image.cpp b/cpp/poppler-image.cpp
index 261c5f7b..daf10f02 100644
--- a/cpp/poppler-image.cpp
+++ b/cpp/poppler-image.cpp
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2010-2011, Pino Toscano <pino@kde.org>
* Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
- * Copyright (C) 2017, 2018, Albert Astals Cid <aacid@kde.org>
+ * Copyright (C) 2017-2019, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2017, Jeroen Ooms <jeroenooms@gmail.com>
* Copyright (C) 2018, Zsombor Hollay-Horvath <hollay.horvath@gmail.com>
* Copyright (C) 2018, Adam Reichold <adam.reichold@t-online.de>
@@ -498,6 +498,9 @@ std::vector<std::string> image::supported_image_formats()
*/
image& image::operator=(const image &pt)
{
+ if (this == &pt)
+ return *this;
+
if (pt.d) {
++pt.d->ref;
}