Map: catch null divesites in map widget selection code

Just to be sure, refuse to add null divesites to the selection.

Moreover, refuse to call the setSelected function on a null-divesite.
I got an unfriendly Qt-Warning there:

"Passing incompatible arguments to C++ functions from JavaScript is
dangerous and deprecated."
"This will throw a JavaScript TypeError in future releases of Qt!"

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-08-25 12:21:37 +02:00 committed by Dirk Hohndel
parent 25b30da244
commit b3fd824d18
2 changed files with 3 additions and 1 deletions

View file

@ -196,6 +196,8 @@ void MapLocationModel::reload(QObject *map)
void MapLocationModel::setSelected(struct dive_site *ds, bool fromClick)
{
m_selectedDs.clear();
if (!ds)
return;
m_selectedDs.append(ds);
if (fromClick)
emit selectedLocationChanged(getMapLocation(ds));