mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 00:56:48 +02:00
Handle no setting manager case
Can't save the fallback generated UUID for machine fingerprint if the user of this stuff doesn't have a settings file. Found this when I noticed needed to initialize com for all the assignment clients
This commit is contained in:
parent
fa9aef8b22
commit
1e66bcae1b
1 changed files with 10 additions and 0 deletions
|
@ -10,8 +10,13 @@
|
|||
//
|
||||
|
||||
#include "FingerprintUtils.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <SettingHandle.h>
|
||||
#include <SettingManager.h>
|
||||
#include <DependencyManager.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <comdef.h>
|
||||
#include <Wbemidl.h>
|
||||
|
@ -171,6 +176,11 @@ QUuid FingerprintUtils::getMachineFingerprint() {
|
|||
// any errors in getting the string
|
||||
QUuid uuid(uuidString);
|
||||
if (uuid == QUuid()) {
|
||||
// if you cannot read a fallback key cuz we aren't saving them, just generate one for
|
||||
// this session and move on
|
||||
if (DependencyManager::get<Setting::Manager>().isNull()) {
|
||||
return QUuid::createUuid();
|
||||
}
|
||||
// read fallback key (if any)
|
||||
Settings settings;
|
||||
uuid = QUuid(settings.value(FALLBACK_FINGERPRINT_KEY).toString());
|
||||
|
|
Loading…
Reference in a new issue