[vala] codegen: Fix crash on string switch statement with just a default label



commit b1c24dd44f68f32476ad9c9fe221853f4f1ffd49
Author: Jürg Billeter <j bitron ch>
Date:   Thu Jan 13 07:09:18 2011 +0100

    codegen: Fix crash on string switch statement with just a default label
    
    Fixes bug 639387.

 codegen/valaccodecontrolflowmodule.vala |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodecontrolflowmodule.vala b/codegen/valaccodecontrolflowmodule.vala
index 254250b..6e7ac13 100644
--- a/codegen/valaccodecontrolflowmodule.vala
+++ b/codegen/valaccodecontrolflowmodule.vala
@@ -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 ();



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