]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
fix warning
[lyx.git] / src / Paragraph.cpp
index 98cd13d81111472f215798c961f263024c70b6d5..2baa9b922e9ae4703fd3524f86c776835c5c56a8 100644 (file)
@@ -52,6 +52,7 @@
 #include "support/lassert.h"
 #include "support/convert.h"
 #include "support/debug.h"
+#include "support/ExceptionMessage.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/Messages.h"
@@ -175,7 +176,7 @@ public:
        Paragraph * owner_;
 
        /// In which Inset?
-       Inset * inset_owner_;
+       Inset const * inset_owner_;
 
        ///
        FontList fontlist_;
@@ -457,7 +458,7 @@ void Paragraph::insertInset(pos_type pos, Inset * inset,
 
 bool Paragraph::eraseChar(pos_type pos, bool trackChanges)
 {
-       LASSERT(pos >= 0 && pos <= size(), /**/);
+       LASSERT(pos >= 0 && pos <= size(), return false);
 
        // keep the logic here in sync with the logic of isMergedOnEndOfParDeletion()
 
@@ -1656,28 +1657,19 @@ void Paragraph::setBeginOfBody()
 
 bool Paragraph::forcePlainLayout() const
 {
-       Inset const * const inset = inInset();
-       if (!inset)
-               return true;
-       return inset->forcePlainLayout();
+       return inInset().forcePlainLayout();
 }
 
 
 bool Paragraph::allowParagraphCustomization() const
 {
-       Inset const * const inset = inInset();
-       if (!inset)
-               return true;
-       return inset->allowParagraphCustomization();
+       return inInset().allowParagraphCustomization();
 }
 
 
 bool Paragraph::usePlainLayout() const
 {
-       Inset const * const inset = inInset();
-       if (!inset)
-               return false;
-       return inset->usePlainLayout();
+       return inInset().usePlainLayout();
 }
 
 
@@ -2390,7 +2382,7 @@ docstring Paragraph::asString(pos_type beg, pos_type end, int options) const
 }
 
 
-void Paragraph::setInsetOwner(Inset * inset)
+void Paragraph::setInsetOwner(Inset const * inset)
 {
        d->inset_owner_ = inset;
 }
@@ -2423,9 +2415,11 @@ void Paragraph::setPlainOrDefaultLayout(DocumentClass const & tclass)
 }
 
 
-Inset * Paragraph::inInset() const
+Inset const & Paragraph::inInset() const
 {
-       return d->inset_owner_;
+       LASSERT(d->inset_owner_, throw ExceptionMessage(BufferException,
+               _("Memory problem"), _("Paragraph not properly initiliazed")));
+       return *d->inset_owner_;
 }