[seed] Fix potential crash (or confusion) in seed_value_t



commit 3797376e36c6863ce6d055ba09f3637574fee6e1
Author: Robert Carr <racarr mireia (none)>
Date:   Mon Mar 2 21:41:11 2009 -0500

    Fix potential crash (or confusion) in seed_value_to_string
---
 libseed/seed-types.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 1c1078c..e04168f 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -1615,14 +1615,14 @@ seed_value_to_string (JSContextRef ctx,
   if (val == NULL)
     return NULL;
 
-  if (JSValueIsBoolean (ctx, val) || JSValueIsNumber (ctx, val))
-    {
-      buf = g_strdup_printf ("%lf", JSValueToNumber (ctx, val, NULL));
-    }
   else if (JSValueIsNull (ctx, val) || JSValueIsUndefined (ctx, val))
     {
       buf = g_strdup ("[null]");
     }
+  else if (JSValueIsBoolean (ctx, val) || JSValueIsNumber (ctx, val))
+    {
+      buf = g_strdup_printf ("%lf", JSValueToNumber (ctx, val, NULL));
+    }
   else
     {
       if (!JSValueIsString (ctx, val))	// In this case,



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