]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix crash on string switch statement with just a default label
authorJürg Billeter <j@bitron.ch>
Thu, 13 Jan 2011 06:09:18 +0000 (07:09 +0100)
committerJürg Billeter <j@bitron.ch>
Thu, 13 Jan 2011 06:09:18 +0000 (07:09 +0100)
Fixes bug 639387.

codegen/valaccodecontrolflowmodule.vala

index 254250b99ac9ba57631c380f00d2048a3f92c996..6e7ac1323c8646e5a6daddb93693184932195bd2 100644 (file)
@@ -1,6 +1,6 @@
 /* valaccodecontrolflowmodule.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2011  Jürg Billeter
  * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
@@ -156,7 +156,9 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
 
                        default_section.emit (this);
 
-                       ccode.close ();
+                       if (n > 0) {
+                               ccode.close ();
+                       }
                }
 
                ccode.close ();