diff --git a/astroid/inference.py b/astroid/inference.py
index <HASH>..<HASH> 100644
--- a/astroid/inference.py
+++ b/astroid/inference.py
@@ -307,6 +307,8 @@ def infer_attribute(self, context=None):
                 except exceptions._NonDeducibleTypeHierarchy:
                     # Can't determine anything useful.
                     pass
+        elif not context:
+            context = contextmod.InferenceContext()
 
         try:
             context.boundnode = owner
Don't crash upon invalid contex on attr. inference (#<I>)