mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-18 21:16:54 +02:00
check for nulls
This commit is contained in:
parent
2192a8b0ec
commit
bc901d613d
1 changed files with 19 additions and 4 deletions
|
@ -590,6 +590,13 @@ void PostgreSQL::initializeMembers()
|
|||
|
||||
initMember(config);
|
||||
|
||||
if (row[0].is_null()) {
|
||||
fprintf(stderr, "Null memberID?!?\n");
|
||||
continue;
|
||||
}
|
||||
if (row[1].is_null()) {
|
||||
fprintf(stderr, "Null NetworkID?!?\n");
|
||||
}
|
||||
std::string memberId = row[0].as<std::string>();
|
||||
std::string networkId = row[1].as<std::string>();
|
||||
|
||||
|
@ -625,11 +632,19 @@ void PostgreSQL::initializeMembers()
|
|||
} catch (std::exception &e) {
|
||||
config["remoteTraceLevel"] = 0;
|
||||
}
|
||||
config["remoteTraceTarget"] = row[10].as<std::string>();
|
||||
try {
|
||||
config["tags"] = json::parse(row[11].as<std::string>());
|
||||
} catch (std::exception &e) {
|
||||
if (!config["remoteTraceTarget"].is_null()) {
|
||||
config["remoteTraceTarget"] = row[10].as<std::string>();
|
||||
} else {
|
||||
config["remoteTraceTarget"] = "";
|
||||
}
|
||||
if (config["tags"].is_null()) {
|
||||
config["tags"] = json::array();
|
||||
} else {
|
||||
try {
|
||||
config["tags"] = json::parse(row[11].as<std::string>());
|
||||
} catch (std::exception &e) {
|
||||
config["tags"] = json::array();
|
||||
}
|
||||
}
|
||||
try {
|
||||
config["vMajor"] = row[12].as<int>();
|
||||
|
|
Loading…
Add table
Reference in a new issue