Add error handling for hex2rgb