Skip to content

Commit

Permalink
fix: Prevent crash due to current layout being null
Browse files Browse the repository at this point in the history
I can't reproduce any crash but it has been seen in the wild.
Doing a code review, I can't find any path for it to be null.

The assert and qWarning will be enough to make a test fail eventually.
  • Loading branch information
iamsergio committed Sep 9, 2024
1 parent d170a49 commit 44bbef3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/Position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ void Positions::deserialize(const LayoutSaver::Position &lp)
continue; // Skip
} else {
assert(LayoutSaver::Layout::s_currentLayoutBeingRestored);
if (!LayoutSaver::Layout::s_currentLayoutBeingRestored) {
/// Doesn't happen, but let's guard it
KDDW_WARN("Positions::deserialize: Current layout is null, report a bug!");
continue;
}
auto serializedFw =
LayoutSaver::Layout::s_currentLayoutBeingRestored->floatingWindowForIndex(
index);
Expand Down

0 comments on commit 44bbef3

Please sign in to comment.