--> AdvancedModuleManager-v10.1.3-dev3129754 solves this issue perfectly <---
The fix from Peter is different from my fix below and his implementation is better.
Thanks Peter for the quick fix.
========= my issue was:
After conversion Joomla 4 to 5 it turned out that with Advanced Module Manager 10.1.2 FREE the option: ‘Hide if Empty’ is not working in J5.
In J4 is work perfectly, but not in J5.
It can be solved with an extra line:
Helper.php,
private static function isEmpty(&$module)