Skip to content

Commit 54a1d0b

Browse files
committed
Added check for UIFigure handle validity
1 parent 8a0a723 commit 54a1d0b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mlapptools.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ function fontColor(uielement, newcolor)
5050

5151
methods (Static, Access = private)
5252
function [win] = getWebWindow(uifigurewindow)
53-
% TODO: Check that we've been passed an app designer figure window
5453
mlapptools.togglewarnings('off')
54+
% Test if uifigurewindow is a valid handle
55+
if ~isa(uifigurewindow,'matlab.ui.Figure') || ...
56+
isempty(struct(uifigurewindow).ControllerInfo)
57+
msgID = 'mlapptools:getWebWindow:NotUIFigure';
58+
error(msgID, 'The provided window handle is not of a UIFigure.');
59+
end
5560

5661
tic
5762
while true && (toc < mlapptools.TIMEOUT)

0 commit comments

Comments
 (0)