SaveTool: add safety measures in drawMassViewer().

This commit is contained in:
Guillaume Jacquemin 2021-08-28 20:22:04 +02:00
parent 7fcf8b518e
commit f3318e0ed1

View file

@ -19,6 +19,12 @@
#include "SaveTool.h" #include "SaveTool.h"
void SaveTool::drawMassViewer() { void SaveTool::drawMassViewer() {
if(!_currentMass || _currentMass->state() != Mass::State::Valid) {
_currentMass = nullptr;
_uiState = UiState::MainManager;
return;
}
ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always); ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always);
ImGui::SetNextWindowSize({Float(windowSize().x()), Float(windowSize().y()) - ImGui::GetItemRectSize().y}, ImGui::SetNextWindowSize({Float(windowSize().x()), Float(windowSize().y()) - ImGui::GetItemRectSize().y},
ImGuiCond_Always); ImGuiCond_Always);