Commit 3c503bcd authored by Aleksy Barcz's avatar Aleksy Barcz

fix segfault when iks base requested on start is absent

+ if an iks base (e.g. given using -base and an invalid ip address) was absent on draw3 startup, and we chose not to try again connecting, draw3 would segfault on set-prober-address query
+ now we launch a draw3 instance with no data (and if the user clicks inside data widget, draw3 will fail on runtime assertion: "Cannot set invalid time!"), this behavior is consistent with the behavior when we open an absent base in a new tab
parent fe7f7bd0
......@@ -95,6 +95,7 @@ void* QueryExecutor::Entry() {
q->prefix = last_prefix;
}
last_prefix = q->prefix;
Draw3Base::ptr base = nullptr;
try{
base = base_handler->GetBaseHandler(q->prefix);
......@@ -104,8 +105,28 @@ void* QueryExecutor::Entry() {
delete q;
continue;
}
if (q->type == DatabaseQuery::ADD_PARAM) {
try{
base = base_handler->GetBaseHandler(q->defined_param.prefix);
}
catch(MissingBasePrefixException& e) {
sz_log(8, "base prefix missing %ls", q->defined_param.prefix );
delete q;
continue;
}
base->AddExtraParam(q);
continue;
}
// following query types require a valid base
if (base == nullptr) {
delete q;
continue;
}
switch (q->type) {
case DatabaseQuery::ADD_BASE_PREFIX:
case DatabaseQuery::ADD_PARAM:
// should not get here
break;
......@@ -117,18 +138,6 @@ void* QueryExecutor::Entry() {
base->CompileLuaFormula(q);
break;
case DatabaseQuery::ADD_PARAM:
try{
base = base_handler->GetBaseHandler(q->defined_param.prefix);
}
catch(MissingBasePrefixException& e) {
sz_log(8, "base prefix missing %ls", q->defined_param.prefix );
delete q;
continue;
}
base->AddExtraParam(q);
break;
case DatabaseQuery::REMOVE_PARAM:
base->RemoveExtraParam(q);
delete q;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment