Setting properties outside transaction should throw

Resolves #40
This commit is contained in:
Scott Kyle 2015-10-12 02:02:23 -07:00
parent d88b089b9f
commit b70e5432b7
1 changed files with 4 additions and 0 deletions

View File

@ -98,6 +98,10 @@ namespace realm {
{ {
using Accessor = NativeAccessor<ValueType, ContextType>; using Accessor = NativeAccessor<ValueType, ContextType>;
if (!realm->is_in_transaction()) {
throw std::runtime_error("Can only set property values within a transaction.");
}
size_t column = property.table_column; size_t column = property.table_column;
switch (property.type) { switch (property.type) {
case PropertyTypeBool: case PropertyTypeBool: