mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Bugfix: AsString() on an EnumVal will segfault
This likely simply hasn't come up in practice, but we now go the intended route of producing the textual enum value from the type.
This commit is contained in:
parent
14ca808bcf
commit
dcf6e7432d
1 changed files with 4 additions and 2 deletions
|
@ -267,7 +267,8 @@ const std::string& ComponentManager<C>::GetComponentName(EnumValPtr val) const {
|
||||||
if ( C* c = Lookup(val.get()) )
|
if ( C* c = Lookup(val.get()) )
|
||||||
return c->CanonicalName();
|
return c->CanonicalName();
|
||||||
|
|
||||||
reporter->InternalWarning("requested name of unknown component tag %s", val->AsString()->CheckString());
|
reporter->InternalWarning("requested name of unknown component tag %s",
|
||||||
|
val->GetType()->AsEnumType()->Lookup(val->Get()));
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +296,8 @@ StringValPtr ComponentManager<C>::GetComponentNameVal(EnumValPtr val) const {
|
||||||
if ( C* c = Lookup(val.get()) )
|
if ( C* c = Lookup(val.get()) )
|
||||||
return c->CanonicalNameVal();
|
return c->CanonicalNameVal();
|
||||||
|
|
||||||
reporter->InternalWarning("requested name of unknown component tag %s", val->AsString()->CheckString());
|
reporter->InternalWarning("requested name of unknown component tag %s",
|
||||||
|
val->GetType()->AsEnumType()->Lookup(val->Get()));
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue