Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend/StarMainInterface.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-22 13:29:42 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-22 13:29:42 +1000
commit87163147b32c260c69d35a976ad412dd4ffcaf50 (patch)
tree8e5e712d00743266f26d25ff5a539dee4c2f7572 /source/frontend/StarMainInterface.cpp
parentca195431ff6a5ca140b35e53a67719286901a622 (diff)
fix crash when disconnecting with inventory open
additionally, fix humanoid identity being constantly sent by the server even when unchanged
Diffstat (limited to 'source/frontend/StarMainInterface.cpp')
-rw-r--r--source/frontend/StarMainInterface.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp
index 4485ffa..2be8c2e 100644
--- a/source/frontend/StarMainInterface.cpp
+++ b/source/frontend/StarMainInterface.cpp
@@ -96,7 +96,8 @@ MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter,
m_inventoryWindow = make_shared<InventoryPane>(this, m_client->mainPlayer(), m_containerInteractor);
m_paneManager.registerPane(MainInterfacePanes::Inventory, PaneLayer::Window, m_inventoryWindow, [this](PanePtr const&) {
- m_client->mainPlayer()->clearSwap();
+ if (auto player = m_client->mainPlayer())
+ player->clearSwap();
if (m_containerPane) {
m_containerPane->dismiss();
m_containerPane = {};
@@ -216,7 +217,8 @@ void MainInterface::openCraftingWindow(Json const& config, EntityId sourceEntity
m_craftingWindow = make_shared<CraftingPane>(m_client->worldClient(), m_client->mainPlayer(), config, sourceEntityId);
m_paneManager.displayPane(PaneLayer::Window, m_craftingWindow, [this](PanePtr const&) {
- m_client->mainPlayer()->clearSwap();
+ if (auto player = m_client->mainPlayer())
+ player->clearSwap();
});
}
@@ -233,7 +235,8 @@ void MainInterface::openMerchantWindow(Json const& config, EntityId sourceEntity
m_paneManager.displayPane(PaneLayer::Window,
m_merchantWindow,
[this](PanePtr const&) {
- m_client->mainPlayer()->clearSwap();
+ if (auto player = m_client->mainPlayer())
+ player->clearSwap();
m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory);
});
m_paneManager.displayRegisteredPane(MainInterfacePanes::Inventory);
@@ -401,7 +404,8 @@ void MainInterface::handleInteractAction(InteractAction interactAction) {
m_containerPane = make_shared<ContainerPane>(world, m_client->mainPlayer(), m_containerInteractor);
m_paneManager.displayPane(PaneLayer::Window, m_containerPane, [this](PanePtr const&) {
- m_client->mainPlayer()->clearSwap();
+ if (auto player = m_client->mainPlayer())
+ player->clearSwap();
m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory);
});
@@ -496,7 +500,8 @@ void MainInterface::handleInteractAction(InteractAction interactAction) {
if (scriptPane->openWithInventory()) {
m_paneManager.displayPane(PaneLayer::Window, scriptPane, [this](PanePtr const&) {
- m_client->mainPlayer()->clearSwap();
+ if (auto player = m_client->mainPlayer())
+ player->clearSwap();
m_paneManager.dismissRegisteredPane(MainInterfacePanes::Inventory);
});
m_paneManager.displayRegisteredPane(MainInterfacePanes::Inventory);