Bugfix: don't crash when a target is expected but is not available
(upstream git commit e767ffcda58ab73cf2c4394202eec7ae1f6035b5)
Bugfix: don't crash if the link.txt file contains empty lines
(upstream git commit 8ff1d4714fb7cd42eb3cd8db041b529e433eb7c8)