From 70b147007e96c9e7bb6c4c301ab3054ddeaa1a0e Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 25 Mar 2024 10:56:32 -0400 Subject: [PATCH] cwPresetSel.cpp : Rewrote _validate_preset_id() to clarify logic. --- cwPresetSel.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cwPresetSel.cpp b/cwPresetSel.cpp index da022ea..0324269 100644 --- a/cwPresetSel.cpp +++ b/cwPresetSel.cpp @@ -405,10 +405,12 @@ namespace cw rc_t _validate_preset_id( const frag_t* frag, unsigned preset_id ) { - bool fl = (preset_id < frag->presetN) && (frag->presetA[ preset_id ].preset_idx == preset_id); - - return fl ? kOkRC : cwLogError(kInvalidIdRC,"The preset id '%i' is invalid on the fragment at loc:%i.",preset_id,frag->endLoc); - + rc_t rc = kOkRC; + + if( (preset_id >= frag->presetN) || (frag->presetA[ preset_id ].preset_idx != preset_id) ) + rc = cwLogError(kInvalidIdRC,"The preset id '%i' is invalid on the fragment at loc:%i.",preset_id,frag->endLoc); + + return rc; } bool _is_master_var_id( unsigned varId )