Skip to content
This repository was archived by the owner on Apr 5, 2019. It is now read-only.

Commit 0cba18b

Browse files
committed
Fix bug in handlecheck method
handlecheck would error when an empty legend object is passed to it. This commit implements detection of an empty legend.
1 parent b42e726 commit 0cba18b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

legtools.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function adddummy(lh, newStrings, plotParams)
236236
function lh = handlecheck(src, lh)
237237
% Make sure lh exists and is a legend object
238238
assert( ...
239-
isgraphics(lh, 'legend') && isvalid(lh), ...
239+
~isempty(lh) && isgraphics(lh,'legend') && isvalid(lh), ...
240240
sprintf('legtools:%s:InvalidLegendHandle', src), ...
241241
'Invalid legend handle provided.' ...
242242
)

0 commit comments

Comments
 (0)