Fixed potential error message when palettes are empty (#729)