diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp
index 3959d953f92df47497a306686fdfeb28c59e23fd..2547b8564d9fb7bd30e9cae4c41dc5cbce5e4804 100644
--- a/src/plugins/cppeditor/cpphoverhandler.cpp
+++ b/src/plugins/cppeditor/cpphoverhandler.cpp
@@ -256,7 +256,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
         const QList<TypeOfExpression::Result> types =
                 typeOfExpression(expression, doc, lastSymbol);
 
-        if (!types.isEmpty()) {
+        if (!types.isEmpty() && types.first().first) {
             FullySpecifiedType firstType = types.first().first;
             Symbol *symbol = types.first().second;
             FullySpecifiedType docType = firstType;
diff --git a/src/shared/cplusplus/Scope.cpp b/src/shared/cplusplus/Scope.cpp
index efb6a369aec6d0984c4b2c8701aee37687081310..200406b6bb585697a02b990951432462627adf28 100644
--- a/src/shared/cplusplus/Scope.cpp
+++ b/src/shared/cplusplus/Scope.cpp
@@ -217,7 +217,7 @@ void Scope::enterSymbol(Symbol *symbol)
 
 Symbol *Scope::lookat(Identifier *id) const
 {
-    if (! _hash)
+    if (! _hash || ! id)
         return 0;
 
     const unsigned h = id->hashCode() % _hashSize;