Am Fri, 19 May 2023 00:09:09 -0400
schrieb Richard Kimberly Heck <rikih...@gmail.com>:

> On 5/18/23 11:02, Kornel Benko wrote:
> > commit f13808939b9ae6d8d467538d17157a87e8a1a37c
> > Author: Kornel Benko <kor...@lyx.org>
> > Date:   Thu May 18 18:07:40 2023 +0200
> >
> >      Advaced search: check for toString() before using it.
> >      (#12783)
> >
> > diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
> > index b8819fd..fed5a74 100644
> > --- a/src/Paragraph.cpp
> > +++ b/src/Paragraph.cpp
> > @@ -4314,7 +4314,7 @@ docstring Paragraph::asString(pos_type beg, pos_type 
> > end, int
> > options, const Out else if (c == META_INSET && (options & AS_STR_INSETS)) {
> >                     if (c == META_INSET && (options & AS_STR_PLAINTEXT)) {
> >                             LASSERT(runparams != nullptr, return 
> > docstring());
> > -                           if (runparams->find_effective())
> > +                           if (runparams->find_effective() &&
> > getInset(i)->hasToString()) getInset(i)->toString(os);
> >                             else
> >                                     getInset(i)->plaintext(os, *runparams); 
> >  
> 
> I know this will be an annoying suggestion after all that work, but what 
> about:
> 
> if (runparams->find_effective) {
>      string str = getInset(i)->toString(os);
>      if (str.empty())
>          str = getInset(i)->plaintext(os, *runaparms);
> }
> 
> ? Then no need for the new method.
> 
> Riki
> 
> 

I was unaware that getInset(i)->toString(os) returns a string (declared as void)
Maybe it would work with
        if (os.str().empty())
but that may not work if 'os' already had some data.

        Kornel

Attachment: pgp3K3dN_HW42.pgp
Description: Digitale Signatur von OpenPGP

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to