logic: licence error handling

Fixed bug #277 and improved error handling in licence code
This commit is contained in:
Manuel Dobusch
2017-01-17 16:46:24 +01:00
parent 39a587aa83
commit 79d5f48454
5 changed files with 297 additions and 78 deletions
+18
View File
@@ -51,6 +51,13 @@ void LicenseChecker::saveCurrentLicenseString(const std::string& licenseString)
}
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
if (appSettings == NULL)
{
LOG_ERROR_STREAM(<< "Unable to retrieve app settings");
return;
}
std::string appPath(AppPath::getAppPath());
appSettings->setLicenseString(license.getLicenseEncodedString(appPath));
@@ -66,10 +73,21 @@ bool LicenseChecker::isCurrentLicenseValid()
LicenseChecker::LicenseState LicenseChecker::checkCurrentLicense() const
{
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
if (appSettings == NULL)
{
LOG_ERROR_STREAM(<< "Unable to retrieve app settings");
return LICENSE_EMPTY;
}
std::string licenseCheck = appSettings->getLicenseCheck();
std::string appPath(AppPath::getAppPath());
if (appPath.size() <= 0)
{
LOG_ERROR_STREAM(<< "Failed to retrieve app path");
return LICENSE_EMPTY;
}
std::string licenseString = appSettings->getLicenseString();
if (licenseString.size() == 0)
{