[seed] make seed_value_from_string return "null" if passed "NULL"
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [seed] make seed_value_from_string return "null" if passed "NULL"
- Date: Sun, 1 Nov 2009 04:02:01 +0000 (UTC)
commit 9cf4a15d929007c9dfdb3c1a1fea6d03825b8614
Author: Iain Nicol <iain thenicols net>
Date: Fri Oct 30 22:08:51 2009 +0000
make seed_value_from_string return "null" if passed "NULL"
libseed/seed-types.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 7995993..5452e04 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -2021,11 +2021,16 @@ JSValueRef
seed_value_from_string (JSContextRef ctx,
const gchar * val, JSValueRef * exception)
{
- JSStringRef jsstr = JSStringCreateWithUTF8CString (val);
- JSValueRef valstr = JSValueMakeString (ctx, jsstr);
- JSStringRelease (jsstr);
+ if (val == NULL)
+ return JSValueMakeNull (ctx);
+ else
+ {
+ JSStringRef jsstr = JSStringCreateWithUTF8CString (val);
+ JSValueRef valstr = JSValueMakeString (ctx, jsstr);
+ JSStringRelease (jsstr);
- return valstr;
+ return valstr;
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]