Skip to content

Commit e077b4b

Browse files
author
Jon-Fredrik Nielsen
committed
Throw error if going past end of P-file
On branch develop modified: loadpfile.m
1 parent 49b73dd commit e077b4b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

+toppe/+utils/loadpfile.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@
126126
for iview = 1:nviews
127127
offsetres = (icoil-1)*coilres + (islice-1)*sliceres + (echo-1)*echores + iview*ndat;
128128
offsetbytes = 2*ptsize*offsetres;
129-
fseek(fid, rdb_hdr.off_data+offsetbytes, 'bof');
129+
if(fseek(fid, rdb_hdr.off_data+offsetbytes, 'bof') == -1)
130+
error('Attempting to move past end of P-file');
131+
end
130132
switch ptsize
131133
case 2,
132134
dtmp = fread(fid, 2*ndat, 'int16=>int16');

0 commit comments

Comments
 (0)