dual-image: Do not erase image if os-release is not found

The code will erase an image if the os-release is not found.
For dual image, the secondary flash may be empty or contains invalid
data, e.g. in factory or lab, so it should just ignore such case instead
of erasing the image.

Without the change, when it tries to erase the image, it crashes in
erase() because the version ID is not available and the code was
accessing the invalidated iterator.

Tested: Verify the crash is fixed in QEMU when the secondary image is
        empty.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I7a1a8da15c31045fc7d51416f6ba0875349067d2
1 file changed