src/Palete/ValaCompileRequest.vala
authorAlan <alan@roojs.com>
Tue, 2 Jan 2024 06:10:09 +0000 (14:10 +0800)
committerAlan <alan@roojs.com>
Tue, 2 Jan 2024 06:10:09 +0000 (14:10 +0800)
src/Palete/ValaCompileRequest.vala

index c61d259..50edb99 100644 (file)
@@ -214,14 +214,16 @@ namespace Palete {
                }
                public int totalErrors(string type, JsRender.JsRender? file=null) 
                {
-                       if (file == null) {
-                               return this.errorByType.get(type) == null ? 0 : (int)this.errorByType.get(type).get_n_items();
-                       }
-                       var ret =0;
                        var ar = this.errorByType.get(type);
                        if (ar == null) {
                                return 0;
                        }
+                       
+                       if (file == null) {
+                               return  (int)this.errorByType.get(type).get_n_items();
+                       }
+                       var ret =0;
+                       
                        for(var i =0 ;i< ar.get_n_items();i++) {
                                var ce = (CompileError) ar.get_item(i);
                                if (ce.file.path == file.path) {