Skip to content

Commit

Permalink
Small fix in NomenclatureMgr
Browse files Browse the repository at this point in the history
When we search around we have to be careful not to consider the items
whose position hasn't been computed yet.  Otherwise we sometime get
crashes when we click in the sky.

I suspect this is what the initialized attribute might have been for,
since it is currently always set to true.  For the moment I just did
a quick fix by initializing the pos to zero and checking that in the
search method.
  • Loading branch information
guillaumechereau committed Oct 23, 2017
1 parent 62da079 commit 71d79f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/modules/NomenclatureItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ NomenclatureItem::NomenclatureItem(PlanetP nPlanet,
float nLongitude,
float nSize)
: initialized(false)
, XYZ(0.0)
, planet(nPlanet)
, identificator(nId)
, englishName(nName)
Expand Down
2 changes: 1 addition & 1 deletion src/core/modules/NomenclatureMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ QList<StelObjectP> NomenclatureMgr::searchAround(const Vec3d& av, double limitFo

foreach(const NomenclatureItemP& nItem, nomenclatureItems)
{
if (nItem->initialized)
if (nItem->initialized && nItem->XYZ.lengthSquared() > 0)
{
equPos = nItem->XYZ;
equPos.normalize();
Expand Down

0 comments on commit 71d79f2

Please sign in to comment.