is hyperspace cloud it does not. Bug can be triggered if ship hyperspaces and there
is cloud analyzer so nav target becames cloud or as I have added clouds to
navtarget list ;)
Code: Select all
diff --git a/src/SystemInfoView.cpp b/src/SystemInfoView.cpp
index 5b67e4d..467ca6e 100644
--- a/src/SystemInfoView.cpp
+++ b/src/SystemInfoView.cpp
@@ -481,15 +481,19 @@ SystemInfoView::RefreshType SystemInfoView::NeedsRefresh()
return REFRESH_SELECTED;
} else {
Body *navTarget = Pi::player->GetNavTarget();
- if (navTarget && navTarget->GetSystemBody()->GetType() != SystemBody::TYPE_STARPORT_SURFACE) {
+ if(navTarget)
+ {
+ const SystemBody* sb = navTarget->GetSystemBody();
+ if (sb && sb->GetType() != SystemBody::TYPE_STARPORT_SURFACE) {
// Navigation target is something we show in the info view
- if (navTarget->GetSystemBody()->GetPath() != m_selectedBodyPath)
+ if (sb->GetPath() != m_selectedBodyPath)
return REFRESH_SELECTED; // and wasn't selected, yet
} else {
// nothing to be selected
if (m_selectedBodyPath.IsBodyPath())
return REFRESH_SELECTED; // but there was something selected
}
+ }
}
return REFRESH_NONE;
@@ -542,12 +546,15 @@ void SystemInfoView::UpdateIconSelections()
if (currentSys && currentSys->GetPath() == m_system->GetPath()) {
//navtarget can be only set in current system
if (Body* navtarget = Pi::player->GetNavTarget()) {
- const SystemPath& navpath = navtarget->GetSystemBody()->GetPath();
+ if (const SystemBody* sb = navtarget->GetSystemBody())
+ {
+ const SystemPath& navpath = sb->GetPath();
if (bodyIcon.first == navpath.bodyIndex) {
bodyIcon.second->SetSelectColor(Color(0, 255, 0, 255));
bodyIcon.second->SetSelected(true);
m_selectedBodyPath = navpath;
}
+ }
}
} else {
SystemPath selected = Pi::sectorView->GetSelected();