diff --git a/src/components/Definition.vue b/src/components/Definition.vue
index 4645f9991da6511b126debe4fdad93b7ccb86889..84986743fe84d58d049b39a50aa3b3bca09d5a58 100644
--- a/src/components/Definition.vue
+++ b/src/components/Definition.vue
@@ -82,10 +82,12 @@ var Definition = {
   watch:{
     $route(to, from) {
       let ref = 'def' + this.body.id
-      if(location.hash.substring(1) == ref){
-        this.$refs[ref].classList.add('highlighted')
-      }else{
-        this.$refs[ref].classList.remove('highlighted')
+      if (this.$refs[ref]) {
+        if(location.hash.substring(1) == ref){
+          this.$refs[ref].classList.add('highlighted')
+        }else {
+          this.$refs[ref].classList.remove('highlighted')
+        }
       }
     }
   }