Fixes #3687: Check if the version exists before trying to use it