Skip to content

Commit 1089cf4

Browse files
committed
fixUnitsBug: add cell check
1 parent ad54241 commit 1089cf4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

+nix/Dynamic.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,21 @@ function set_method(obj, val)
2222
prop, class(obj)));
2323
throwAsCaller(ME);
2424
end
25-
25+
2626
if (isempty(val))
2727
nix_mx(strcat(obj.alias, '::set_none_', prop), obj.nix_handle, 0);
28+
elseif(strcmp(prop, 'units') && (~iscell(val)))
29+
%-- BUGFIX: Matlab crashes, if units in Tags and MultiTags
30+
%-- are set using anything else than a cell.
31+
ME = MException('MATLAB:class:SetProhibited', sprintf(...
32+
'Units can be only set by using cells.'));
33+
throwAsCaller(ME);
2834
else
2935
nix_mx(strcat(obj.alias, '::set_', prop), obj.nix_handle, val);
3036
end
3137
obj.info = nix_mx(strcat(obj.alias, '::describe'), obj.nix_handle);
3238
end
33-
39+
3440
function val = get_method(obj)
3541
val = obj.info.(prop);
3642
end

0 commit comments

Comments
 (0)