[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdev-python] duchain: Do not crash if documentation context is not yet parsed
From:       Sven Brauch <svenbrauch () googlemail ! com>
Date:       2015-01-25 16:39:48
Message-ID: E1YFQE0-0004uQ-2A () scm ! kde ! org
[Download RAW message or body]

Git commit aef2f3c81a2f3227e48e68a5aaf46d1a1f489d0b by Sven Brauch.
Committed on 25/01/2015 at 16:39.
Pushed by brauch into branch 'master'.

Do not crash if documentation context is not yet parsed

BUG:342977

M  +7    -4    duchain/expressionvisitor.cpp

http://commits.kde.org/kdev-python/aef2f3c81a2f3227e48e68a5aaf46d1a1f489d0b

diff --git a/duchain/expressionvisitor.cpp b/duchain/expressionvisitor.cpp
index cd825f7..308c17c 100644
--- a/duchain/expressionvisitor.cpp
+++ b/duchain/expressionvisitor.cpp
@@ -672,10 +672,13 @@ AbstractType::Ptr \
ExpressionVisitor::fromBinaryOperator(AbstractType::Ptr lhs, A  }
         auto operatorFunctionType = func->type<FunctionType>();
         DUChainReadLocker lock;
-        auto object_decl = \
Helper::getDocumentationFileContext()->findDeclarations(QualifiedIdentifier("object"));
                
-        if ( ! object_decl.isEmpty() && object_decl.first()->internalContext() == \
                func->context() ) {
-            // if the operator is only declared in object(), do not include its type \
                (which is void).
-            return AbstractType::Ptr();
+        auto context = Helper::getDocumentationFileContext();
+        if ( context ) {
+            auto object_decl = \
context->findDeclarations(QualifiedIdentifier("object")); +            if ( ! \
object_decl.isEmpty() && object_decl.first()->internalContext() == func->context() ) \
{ +                // if the operator is only declared in object(), do not include \
its type (which is void). +                return AbstractType::Ptr();
+            }
         }
         return operatorFunctionType ? operatorFunctionType->returnType() : \
AbstractType::Ptr();  };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic