Skip to content

Commit

Permalink
Use early return style
Browse files Browse the repository at this point in the history
  • Loading branch information
JoergAtGithub committed Jul 1, 2024
1 parent 9b6997f commit 74fac0a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/widget/paintable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Paintable::DrawMode Paintable::DrawModeFromString(const QString& str) {
{"TILE", DrawMode::Tile}};

auto it = stringMap.find(str.toUpper());
if (it != stringMap.end()) {
return it.value();
} else {
if (it == stringMap.end()) {
qWarning() << "Unknown DrawMode string passed to DrawModeFromString:"
<< str << "using DrawMode::Fixed as fallback";
return DrawMode::Fixed;
}

return it.value();
}

// static
Expand All @@ -40,14 +40,14 @@ QString Paintable::DrawModeToString(DrawMode mode) {
{DrawMode::Tile, "TILE"}};

auto it = modeMap.find(mode);
if (it != modeMap.end()) {
return it.value();
} else {
if (it == modeMap.end()) {
qWarning() << "Unknown DrawMode passed to DrawModeToString "
<< static_cast<int>(mode) << "using FIXED as fallback";
DEBUG_ASSERT(false);
return "FIXED";
}

return it.value();
}

Paintable::Paintable(const PixmapSource& source, DrawMode mode, double scaleFactor)
Expand Down

0 comments on commit 74fac0a

Please sign in to comment.