Fix potential Engine NPE

If somehow you get an engine with an invalid metadata value, it would
crash.