From b3c2efe817ec5c8aa411b16420b34389322bf3ef Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 31 Jan 2018 13:44:26 +0100 Subject: [PATCH] fix #228 - possible infinite loop when compiling a runnable with auto solved dependencies --- src/ce_libman.pas | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/ce_libman.pas b/src/ce_libman.pas index 4fc7411a..bb7aaa58 100644 --- a/src/ce_libman.pas +++ b/src/ce_libman.pas @@ -601,17 +601,23 @@ begin // add the library files and the import paths for the selection if not sel.IsEmpty then with sel.Iterator do begin - while true do if data.hasValidLibFile then + while true do begin - if not data.enabled then - fMsgs.message(format(deactivatedMessage, [data.libAlias]), - nil, amcAutoCompile, amkWarn) - else + itm := Data; + if itm.isNil then + break; + if itm.hasValidLibFile then begin - libs.Add(Data.libFile); - paths.Add('-I' + Data.libSourcePath); + if not itm.enabled then + fMsgs.message(format(deactivatedMessage, [itm.libAlias]), + nil, amcAutoCompile, amkWarn) + else + begin + libs.Add(itm.libFile); + paths.Add('-I' + itm.libSourcePath); + end; end; - if not Next then + if not next then break; end; free;