]> git.lyx.org Git - lyx.git/commitdiff
Amend 28e8bf742.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Sat, 18 Nov 2023 00:31:55 +0000 (19:31 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Sat, 18 Nov 2023 00:32:49 +0000 (19:32 -0500)
The default 'empty' layout has "UNDEFINED" for the LabelString.

src/insets/InsetBranch.cpp

index 2118a6f9471b131ce6315819c0e2a766fdc791c2..7a97e2c3b4a32993a794a134e63d6b1551cde664 100644 (file)
@@ -118,10 +118,18 @@ docstring const InsetBranch::buttonLabel(BufferView const &) const
        if (decoration() == InsetDecoration::MINIMALISTIC)
                return symb + inv_symb + params_.branch;
 
-       InsetLayout const & il = getLayout();
-       docstring const & label_string = il.labelstring();
-       if (!label_string.empty())
-               return symb + inv_symb + label_string;
+       if (!buffer_) {
+               return symb + inv_symb + _("Branch (undefined): ")
+                       + params_.branch;
+       }
+       bool const has_layout =
+               buffer().params().documentClass().hasInsetLayout(layoutName());
+       if (has_layout) {
+               InsetLayout const & il = getLayout();
+               docstring const & label_string = il.labelstring();
+               if (!label_string.empty())
+                       return symb + inv_symb + label_string;
+       }
        docstring s;
        if (inmaster && inchild)
                s = _("Branch: ");