Skip to content

Commit fefb979

Browse files
committed
add input checks on drawFieldOfView
1 parent 52e7d05 commit fefb979

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/drawFieldOfVIew.m

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@ function drawFieldOfVIew(cfg)
66
% stimuli if you know the FOV of the participant will be obstructed by
77
% something
88

9-
RED = [255 0 0];
10-
penWidth = 2;
11-
12-
fov = cfg.screen.effectiveFieldOfView;
13-
14-
fov = CenterRect(...
15-
[0, 0, fov(1), fov(2)], ...
16-
cfg.screen.winRect);
9+
if isfield(cfg.screen, 'effectiveFieldOfView') && ...
10+
numel(cfg.screen.effectiveFieldOfView)==2
1711

18-
Screen('FrameRect', ...
19-
cfg.screen.win, ...
20-
RED, ...
21-
fov, ...
22-
penWidth);
23-
12+
RED = [255 0 0];
13+
penWidth = 2;
14+
15+
fov = cfg.screen.effectiveFieldOfView;
16+
17+
fov = CenterRect(...
18+
[0, 0, fov(1), fov(2)], ...
19+
cfg.screen.winRect);
20+
21+
Screen('FrameRect', ...
22+
cfg.screen.win, ...
23+
RED, ...
24+
fov, ...
25+
penWidth);
26+
end
2427

2528
end

0 commit comments

Comments
 (0)