[mdtool] Don't crash when doing a Clean

Fixes bug #12257