diff --git a/connectivity/private/ft_notification.m b/connectivity/private/ft_notification.m index cd0d2ddbcb..355e71c52b 100644 --- a/connectivity/private/ft_notification.m +++ b/connectivity/private/ft_notification.m @@ -330,8 +330,10 @@ % store the last notification state.message = strtrim(sprintf(varargin{:})); % remove the trailing newline state.identifier = msgId; - state.stack = stack; - s = setstate(s, 'last', state); + if ~isempty(stack) + state.stack = stack; + s = setstate(s, 'last', state); + end if strcmp(msgState, 'on') diff --git a/fileio/private/ft_notification.m b/fileio/private/ft_notification.m index cd0d2ddbcb..355e71c52b 100644 --- a/fileio/private/ft_notification.m +++ b/fileio/private/ft_notification.m @@ -330,8 +330,10 @@ % store the last notification state.message = strtrim(sprintf(varargin{:})); % remove the trailing newline state.identifier = msgId; - state.stack = stack; - s = setstate(s, 'last', state); + if ~isempty(stack) + state.stack = stack; + s = setstate(s, 'last', state); + end if strcmp(msgState, 'on') diff --git a/forward/private/ft_notification.m b/forward/private/ft_notification.m index cd0d2ddbcb..355e71c52b 100644 --- a/forward/private/ft_notification.m +++ b/forward/private/ft_notification.m @@ -330,8 +330,10 @@ % store the last notification state.message = strtrim(sprintf(varargin{:})); % remove the trailing newline state.identifier = msgId; - state.stack = stack; - s = setstate(s, 'last', state); + if ~isempty(stack) + state.stack = stack; + s = setstate(s, 'last', state); + end if strcmp(msgState, 'on') diff --git a/inverse/private/ft_notification.m b/inverse/private/ft_notification.m index cd0d2ddbcb..355e71c52b 100644 --- a/inverse/private/ft_notification.m +++ b/inverse/private/ft_notification.m @@ -330,8 +330,10 @@ % store the last notification state.message = strtrim(sprintf(varargin{:})); % remove the trailing newline state.identifier = msgId; - state.stack = stack; - s = setstate(s, 'last', state); + if ~isempty(stack) + state.stack = stack; + s = setstate(s, 'last', state); + end if strcmp(msgState, 'on') diff --git a/plotting/private/ft_notification.m b/plotting/private/ft_notification.m index cd0d2ddbcb..355e71c52b 100644 --- a/plotting/private/ft_notification.m +++ b/plotting/private/ft_notification.m @@ -330,8 +330,10 @@ % store the last notification state.message = strtrim(sprintf(varargin{:})); % remove the trailing newline state.identifier = msgId; - state.stack = stack; - s = setstate(s, 'last', state); + if ~isempty(stack) + state.stack = stack; + s = setstate(s, 'last', state); + end if strcmp(msgState, 'on') diff --git a/preproc/private/ft_notification.m b/preproc/private/ft_notification.m index cd0d2ddbcb..355e71c52b 100644 --- a/preproc/private/ft_notification.m +++ b/preproc/private/ft_notification.m @@ -330,8 +330,10 @@ % store the last notification state.message = strtrim(sprintf(varargin{:})); % remove the trailing newline state.identifier = msgId; - state.stack = stack; - s = setstate(s, 'last', state); + if ~isempty(stack) + state.stack = stack; + s = setstate(s, 'last', state); + end if strcmp(msgState, 'on') diff --git a/specest/private/ft_notification.m b/specest/private/ft_notification.m index cd0d2ddbcb..355e71c52b 100644 --- a/specest/private/ft_notification.m +++ b/specest/private/ft_notification.m @@ -330,8 +330,10 @@ % store the last notification state.message = strtrim(sprintf(varargin{:})); % remove the trailing newline state.identifier = msgId; - state.stack = stack; - s = setstate(s, 'last', state); + if ~isempty(stack) + state.stack = stack; + s = setstate(s, 'last', state); + end if strcmp(msgState, 'on')