Skip to content

Commit

Permalink
Bug fix: Duplicate subject process was crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
ftadel committed Jun 20, 2019
1 parent 606f518 commit 6b6de45
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions toolbox/process/functions/process_duplicate.m
Expand Up @@ -26,7 +26,7 @@
% For more information type "brainstorm license" at command prompt.
% =============================================================================@
%
% Authors: Francois Tadel, 2012-2014
% Authors: Francois Tadel, 2012-2019

eval(macro_method);
end
Expand Down Expand Up @@ -134,7 +134,7 @@
for iSubj = 1:length(uniqueSubj)
oldName = uniqueSubj{iSubj};
% Cannot duplicate the default subject
if strcmpi(oldName, bst_get('DirDefaultSubject'));
if strcmpi(oldName, bst_get('DirDefaultSubject'))
bst_report('Error', sProcess, sInputs, 'Cannot duplicate default subject.');
continue;
end
Expand All @@ -144,7 +144,10 @@
[newName, Messages] = DuplicateSubject(oldName, fileTag, 0);
% Update the filenames
if ~isempty(newName)
OutputFiles = cat(2, OutputFiles, strrep({sInputs(iInputSubj).FileName}, oldName, newName));
for iFile = 1:length(iInputSubj)
fNameSplit = str_split(sInputs(iInputSubj(iFile)).FileName);
OutputFiles = cat(2, OutputFiles, bst_fullfile(newName, fNameSplit{2:end}));
end
else
bst_report('Error', sProcess, sInputs, Messages);
continue;
Expand Down

0 comments on commit 6b6de45

Please sign in to comment.