diff --git a/README.rst b/README.rst
index 58fde28..25cc75e 100644
--- a/README.rst
+++ b/README.rst
@@ -1,4 +1,4 @@
-overrides 
+overrides
 =========
 
 .. image:: https://api.travis-ci.org/mkorpela/overrides.svg
@@ -46,7 +46,7 @@ Usage
 
     from overrides import overrides
 
-    class SuperClass(object):
+    class SuperClass:
 
         def method(self):
             """This is the doc for a method and will be shown in subclass method too!"""
@@ -74,12 +74,13 @@ Enforcing usage
         def method(self):
             """This is the doc for a method and will be shown in subclass method too!"""
             return 2
-        
+
         def method2(self):
             """This is the doc for a method and will be shown in subclass method too!"""
             return 2
-        
-        def method3(self):
+
+        @staticmethod
+        def method3():
             """This is the doc for a method and will be shown in subclass method too!"""
             return 2
 
@@ -90,14 +91,14 @@ Enforcing usage
         def method(self): # <-- overriding a final method
             return 1
 
-    
+
     # THIS FAILS
     class SubClass2(SuperClass):
 
         def method2(self): # <-- @overrides decorator missing
             return 1
-            
-            
+
+
     # THIS ONE IS OK
     class SubClass3(SuperClass):
 
@@ -106,4 +107,10 @@ Enforcing usage
             return 1
 
 
+    # ENSURE THAT @classmethod AND @staticmethod ARE PLACED AT THE TOP
+    class SubClass4(SuperClass):
 
+        @staticmethod
+        @overrides
+        def method3():
+            return 1
diff --git a/overrides/overrides.py b/overrides/overrides.py
index 80ad368..48ea57b 100644
--- a/overrides/overrides.py
+++ b/overrides/overrides.py
@@ -142,5 +142,6 @@ def _get_base_class(components, namespace):
         else:
             obj = getattr(namespace["__builtins__"], components[0])
     for component in components[1:]:
-        obj = getattr(obj, component)
+        if hasattr(obj, component):
+            obj = getattr(obj, component)
     return obj

Strange error if using a class decorator with a dynamic parameter in a function
I encountered a strange error that I managed to reproduce with the following example:

```
from typing import Callable, Type
from overrides import overrides


class SuperClass(object):
    def method(self) -> int:
        """This is the doc for a method and will be shown in subclass method too!"""
        return 2


def my_decorator(name: str) -> Callable:
    def func(cls: Type) -> Type:
        return cls

    return func


class MyClass:
    def __init__(self, name: str):
        self.my_name: str = name


def my_func() -> None:
    my_object = MyClass("Slartibartfast")

    @my_decorator(my_object.my_name)
    class SubClass(SuperClass):
        @overrides
        def method(self) -> int:
            return 1


my_func()
```

The resulting error message:

```
Traceback (most recent call last):
  File "repro.py", line 33, in <module>
    my_func()
  File "repro.py", line 27, in my_func
    class SubClass(SuperClass):
  File "repro.py", line 29, in SubClass
    def method(self) -> int:
  File "/home/username/.local/lib/python3.6/site-packages/overrides/overrides.py", line 59, in overrides
    for super_class in _get_base_classes(sys._getframe(2), method.__globals__):
  File "/home/username/.local/lib/python3.6/site-packages/overrides/overrides.py", line 76, in _get_base_classes
    class_name_components in _get_base_class_names(frame)]
  File "/home/username/.local/lib/python3.6/site-packages/overrides/overrides.py", line 76, in <listcomp>
    class_name_components in _get_base_class_names(frame)]
  File "/home/username/.local/lib/python3.6/site-packages/overrides/overrides.py", line 173, in _get_base_class
    obj = getattr(obj, component)
AttributeError: 'function' object has no attribute 'my_name'
```
diff --git a/tests/test_decorator_params.py b/tests/test_decorator_params.py
new file mode 100644
index 0000000..0620394
--- /dev/null
+++ b/tests/test_decorator_params.py
@@ -0,0 +1,28 @@
+from typing import Callable, Type
+from overrides import overrides
+
+
+class SuperClass:
+    def method(self) -> int:
+        return 2
+
+
+def my_decorator(name: str) -> Callable:
+    def func(cls: Type) -> Type:
+        return cls
+    return func
+
+
+class MyClass:
+    def __init__(self, name: str):
+        self.my_name: str = name
+
+
+def test_my_func() -> None:
+    my_object = MyClass("Name accessed in decorator")
+
+    @my_decorator(my_object.my_name)
+    class SubClass(SuperClass):
+        @overrides
+        def method(self) -> int:
+            return 1

pip install -e .
parse_log_pytest
pytest
nose nose-cov tissue coveralls pytest
apt-get update apt-get install -y gcc
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
charset-normalizer==2.0.12
cov-core==1.15.0
coverage==6.2
coveralls==3.3.1
docopt==0.6.2
idna==3.10
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
nose==1.3.7
nose-cov==1.6
-e git+https://github.com/mkorpela/overrides.git@8bef1e2b44ef7c9d7a04c9e8465e3c09c5b7549b#egg=overrides
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pep8==1.7.1
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
requests==2.27.1
tissue==0.9.2
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: overrides
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - charset-normalizer==2.0.12
      - cov-core==1.15.0
      - coverage==6.2
      - coveralls==3.3.1
      - docopt==0.6.2
      - idna==3.10
      - nose==1.3.7
      - nose-cov==1.6
      - pep8==1.7.1
      - requests==2.27.1
      - tissue==0.9.2
      - urllib3==1.26.20
prefix: /opt/conda/envs/overrides

tests/test_decorator_params.py::test_my_func
README.rst overrides/overrides.py
README.rst overrides/overrides.py