summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-29 21:53:25 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-30 12:32:55 +0100
commit2d97a4b9d7c6d84cb8b22302cd22f805a4ab76b0 (patch)
tree77453315596574d874821f78075ffabb6731e76c /src/being.cpp
parent87470d984cc8f6fe12a354aec7bf93ee4fcb95eb (diff)
downloadmana-2d97a4b9d7c6d84cb8b22302cd22f805a4ab76b0.tar.gz
mana-2d97a4b9d7c6d84cb8b22302cd22f805a4ab76b0.tar.bz2
mana-2d97a4b9d7c6d84cb8b22302cd22f805a4ab76b0.tar.xz
mana-2d97a4b9d7c6d84cb8b22302cd22f805a4ab76b0.zip
Apply readability-delete-null-pointer fixits
These checks are unnecessary as deleting a null pointer has no effect.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/being.cpp b/src/being.cpp
index d6b36cc6..ef07684f 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -297,9 +297,7 @@ void Being::setSpeech(const std::string &text, int time)
const int speech = config.getIntValue("speech");
if (speech == TEXT_OVERHEAD)
{
- if (mText)
- delete mText;
-
+ delete mText;
mText = new Text(mSpeech,
getPixelX(), getSpeechTextYPosition(),
gcn::Graphics::CENTER,
@@ -912,11 +910,8 @@ void Being::drawSpeech(int offsetX, int offsetY)
{
const bool showName = (speech == NAME_IN_BUBBLE);
- if (mText)
- {
- delete mText;
- mText = nullptr;
- }
+ delete mText;
+ mText = nullptr;
mSpeechBubble->setCaption(showName ? mName : "", mTextColor);
@@ -943,9 +938,7 @@ void Being::drawSpeech(int offsetX, int offsetY)
{
mSpeechBubble->setVisible(false);
- if (mText)
- delete mText;
-
+ delete mText;
mText = nullptr;
}
}