Add a few extra null checks, plus a missing initialization that led to a bad null check

This commit is contained in:
Tim Wojtulewicz 2025-07-21 15:26:38 -07:00
parent 2e5db823ef
commit d22810e476
3 changed files with 7 additions and 4 deletions

View file

@ -490,6 +490,9 @@ void ID::DescribeReST(ODesc* d, bool roles_only) const {
ModuleName() != "Version" ) { ModuleName() != "Version" ) {
d->Add(":Default:"); d->Add(":Default:");
auto ii = zeekygen_mgr->GetIdentifierInfo(Name()); auto ii = zeekygen_mgr->GetIdentifierInfo(Name());
if ( ! ii )
return;
auto redefs = ii->GetRedefs(); auto redefs = ii->GetRedefs();
const auto& iv = ! redefs.empty() && ii->InitialVal() ? ii->InitialVal() : val; const auto& iv = ! redefs.empty() && ii->InitialVal() ? ii->InitialVal() : val;

View file

@ -1734,10 +1734,10 @@ WhenInfo::WhenInfo(ExprPtr arg_cond, FuncType::CaptureList* arg_cl, bool arg_is_
} }
WhenInfo::WhenInfo(const WhenInfo* orig) { WhenInfo::WhenInfo(const WhenInfo* orig) {
if ( orig->cl ) { cl = new FuncType::CaptureList;
cl = new FuncType::CaptureList;
if ( orig->cl )
*cl = *orig->cl; *cl = *orig->cl;
}
cond = orig->OrigCond()->Duplicate(); cond = orig->OrigCond()->Duplicate();

View file

@ -2398,7 +2398,7 @@ ValPtr TableVal::Remove(const Val& index, bool broker_forward, bool* iterators_i
if ( broker_forward && ! broker_store.empty() ) if ( broker_forward && ! broker_store.empty() )
SendToStore(&index, nullptr, ELEMENT_REMOVED); SendToStore(&index, nullptr, ELEMENT_REMOVED);
if ( change_func ) { if ( change_func && k ) {
// this is totally cheating around the fact that we need a Intrusive pointer. // this is totally cheating around the fact that we need a Intrusive pointer.
ValPtr changefunc_val = RecreateIndex(*(k.get())); ValPtr changefunc_val = RecreateIndex(*(k.get()));
CallChangeFunc(changefunc_val, va, ELEMENT_REMOVED); CallChangeFunc(changefunc_val, va, ELEMENT_REMOVED);