summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-05-30 03:19:09 -0600
committerJohn Wiegley <johnw@newartisans.com>2010-05-30 03:19:09 -0600
commitd5ea3080a7322730a28009bb3190631f371234db (patch)
treeb90286d58cd807f3bd62f0e431a0917dfa524f54 /src/value.cc
parent4f3b39e22c7a7743132ead79b1e092929679de44 (diff)
downloadfork-ledger-d5ea3080a7322730a28009bb3190631f371234db.tar.gz
fork-ledger-d5ea3080a7322730a28009bb3190631f371234db.tar.bz2
fork-ledger-d5ea3080a7322730a28009bb3190631f371234db.zip
Allow null values to be cast to int and string
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/value.cc b/src/value.cc
index 9515de46..a967eeb8 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -1075,8 +1075,27 @@ void value_t::in_place_cast(type_t cast_type)
}
switch (type()) {
+ case VOID:
+ switch (cast_type) {
+ case INTEGER:
+ set_long(0L);
+ return;
+ case AMOUNT:
+ set_amount(0L);
+ return;
+ case STRING:
+ set_string("");
+ return;
+ default:
+ break;
+ }
+ break;
+
case BOOLEAN:
switch (cast_type) {
+ case INTEGER:
+ set_long(as_boolean() ? 1L : 0L);
+ return;
case AMOUNT:
set_amount(as_boolean() ? 1L : 0L);
return;