From 926bda8c51a36aa784544e148a28927c02047702 Mon Sep 17 00:00:00 2001 From: Thomas Lambert <t.lambert@uliege.be> Date: Fri, 25 Nov 2022 21:24:07 +0100 Subject: [PATCH] fix(xf2mat): raise error when wrong input This adds a check to raise an error when the file is completely read and it has not be determined to be a xfoil or xflr5 result file. This prevent an infinite loop while trying to determine the result type. --- +af_tools/xf2mat.m | 4 ++++ CHANGELOG.md | 2 ++ 2 files changed, 6 insertions(+) diff --git a/+af_tools/xf2mat.m b/+af_tools/xf2mat.m index dfafffb..782cdba 100644 --- a/+af_tools/xf2mat.m +++ b/+af_tools/xf2mat.m @@ -122,6 +122,10 @@ function Polar = xf2mat(varargin) progName = 'XFOIL'; elseif ~isempty(tmpProgname) && strcmp(tmpProgname(1:5), 'xflr5') progName = 'XFLR5'; + elseif feof(fileID) + error('MATLAB:xf2mat:WrongInputFile', ... + ['The input file does not seems to be a valid XFOIL or XFLR5 results file.'... + ' Are you sure you loaded RESULTS files and not coordinate points?']); end end diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce5962..8ef1d75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- **xf2mat**: add error when input is not a proper xfoil/xflr5 result + - **plotpolar**: fix issue when unavailable data ## [4.0.0] - 2022-06-09 -- GitLab