Don't crash when using custom commands. Fix 8b3856a45a329d0e5be914967f044ecc72eee118.

Thanks Sixthly for pointing this out.