[vala/staging] vala: Report error for error-domains without any code



commit e96b6ab9ab754fe33f6ff002ef80e371153dc716
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Jul 12 11:33:57 2018 +0200

    vala: Report error for error-domains without any code

 vala/valaerrordomain.vala | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/vala/valaerrordomain.vala b/vala/valaerrordomain.vala
index 1c63e51f3..c0e92e70e 100644
--- a/vala/valaerrordomain.vala
+++ b/vala/valaerrordomain.vala
@@ -114,6 +114,12 @@ public class Vala.ErrorDomain : TypeSymbol {
 
                checked = true;
 
+               if (codes.size <= 0) {
+                       Report.error (source_reference, "Error domain `%s' requires at least one code".printf 
(get_full_name ()));
+                       error = true;
+                       return false;
+               }
+
                foreach (ErrorCode ecode in codes) {
                        ecode.check (context);
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]