Changeset 38af1f2 in subsurface


Ignore:
Timestamp:
May 6, 2017, 11:12:07 AM (7 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
9e45999
Parents:
67fbf60
git-author:
Dirk Hohndel <dirk@…> (05/06/17 11:06:18)
git-committer:
Dirk Hohndel <dirk@…> (05/06/17 11:12:07)
Message:

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@…>

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • core/gpslocation.cpp

    rb368ecd r38af1f2  
    4545
    4646        return m_Instance;
     47}
     48
     49bool GpsLocation::hasInstance()
     50{
     51        return m_Instance != NULL;
    4752}
    4853
  • core/gpslocation.h

    rb368ecd r38af1f2  
    2828        ~GpsLocation();
    2929        static GpsLocation *instance();
     30        static bool hasInstance();
    3031        bool applyLocations();
    3132        int getGpsNum() const;
  • desktop-widgets/subsurfacewebservices.cpp

    r9021a44 r38af1f2  
    399399        if (userid.isEmpty() &&
    400400            !same_string(prefs.cloud_storage_email, "") &&
    401             !same_string(prefs.cloud_storage_password, ""))
     401            !same_string(prefs.cloud_storage_password, "") &&
     402            GpsLocation::hasInstance())
    402403                userid = GpsLocation::instance()->getUserid(prefs.cloud_storage_email, prefs.cloud_storage_password);
    403404
Note: See TracChangeset for help on using the changeset viewer.