Am Mittwoch, den 14.02.2018, 10:11 -0500 schrieb Richard Heck:
> > I wonder how that happens. 
> 
> LyXCiteEngine const * CiteEnginesList::operator[](string const & str)
> const
> {
>     LyXCiteEnginesList::const_iterator it = englist_.begin();
>     for (; it != englist_.end(); ++it)
>         if (it->getID() == str) {
>             LyXCiteEngine const & eng = *it;
>             return ŋ
>         }
>     return 0;
> }
> 
> The crucial point seems to be that we are in a const function, so we
> return a null pointer. Boom.

It didn't mean technically. That's clear. I mean how the empty string
comes into the LyX file. Any sane LyX 2.3 document should have _some_
cite engine set.

> 
> > Anyway, would be the following more safe (if
> > we have an unknown non-empty string)?
> > 
> >        return theCiteEnginesList[fromqstr(engine)]
> >     && theCiteEnginesList[fromqstr(engine)]->getCiteFramework()
> >        == "biblatex";
> > 
> > This should also cover the empty case.
> 
> Maybe what would be best is to create and use
> CiteEnginesList::hasEngine(const & string). Then add an assertion to
> the
> function quoted above. This is how things are done in other places.

Maybe, but for now, isn't a check whether the pointer is null better
than checking just the string emptiness?

Jürgen

> 
> Richard
> 
> 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to