From faa1297d3bd75e9e8e2ab2022c2e762caf9ab5f8 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Tue, 27 Oct 2015 10:04:56 -0700 Subject: [PATCH] support null for basic propety types --- object_accessor.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/object_accessor.hpp b/object_accessor.hpp index 25d79dfd..cd45e8f7 100644 --- a/object_accessor.hpp +++ b/object_accessor.hpp @@ -156,6 +156,11 @@ namespace realm { } size_t column = property.table_column; + if (property.is_nullable && Accessor::is_null(ctx, value)) { + m_row.set_null(column); + return; + } + switch (property.type) { case PropertyTypeBool: m_row.set_bool(column, Accessor::to_bool(ctx, value)); @@ -209,6 +214,10 @@ namespace realm { using Accessor = NativeAccessor; size_t column = property.table_column; + if (property.is_nullable && m_row.is_null(column)) { + return Accessor::null_value(ctx); + } + switch (property.type) { case PropertyTypeBool: return Accessor::from_bool(ctx, m_row.get_bool(column));