diff --git a/res/js/component/app.js b/res/js/component/app.js
index d45fb4b946ab7a12e79d82c208e7d79d74ce0418..72d047a517381bde9f651c5bd7c103ac25389ea2 100644
--- a/res/js/component/app.js
+++ b/res/js/component/app.js
@@ -63,8 +63,8 @@ class App {
             this.resultContainer.removeChild(buffer.elem);
         }
         if (this.error) {
-            this.error = null;
             this.resultContainer.removeChild(this.error.elem);
+            this.error = null;
         }
     }
     clearAll() {
diff --git a/res/js/component/app.jsx b/res/js/component/app.jsx
index 44dbf4dca379c4fbd7da0333885ea328c31a3b42..589d0496b4ab62a7baa7e89d68d20f437178156a 100644
--- a/res/js/component/app.jsx
+++ b/res/js/component/app.jsx
@@ -70,8 +70,8 @@ class App {
         }
 
         if (this.error) {
-            this.error = null;
             this.resultContainer.removeChild(this.error.elem);
+            this.error = null;
         }
     }