summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/subsurfacewebservices.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-06 11:06:18 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-06 11:12:07 -0700
commit38af1f2ab93f2ed20552b0869a02844778138739 (patch)
tree3de4dccd977b9cdf023bf5ba329a97312097eb08 /desktop-widgets/subsurfacewebservices.cpp
parent67fbf6009a36233d6621e4f40002fc016a464404 (diff)
downloadsubsurface-38af1f2ab93f2ed20552b0869a02844778138739.tar.gz
Check if we have an instance before dereferencing it
If we don't have a GPS service userid in the preferences and the GpsLocation class isn't instantiated, this would cause a crash. Fixes #367 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/subsurfacewebservices.cpp')
-rw-r--r--desktop-widgets/subsurfacewebservices.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp
index 2d8681a8a..1182af097 100644
--- a/desktop-widgets/subsurfacewebservices.cpp
+++ b/desktop-widgets/subsurfacewebservices.cpp
@@ -398,7 +398,8 @@ SubsurfaceWebServices::SubsurfaceWebServices(QWidget *parent, Qt::WindowFlags f)
if (userid.isEmpty() &&
!same_string(prefs.cloud_storage_email, "") &&
- !same_string(prefs.cloud_storage_password, ""))
+ !same_string(prefs.cloud_storage_password, "") &&
+ GpsLocation::hasInstance())
userid = GpsLocation::instance()->getUserid(prefs.cloud_storage_email, prefs.cloud_storage_password);
ui.userID->setText(userid);