Update snippet.gallery.php

Empty galleries return an empty string. ($data)
PHP throws a fatal error "Cannot use string offset as an array".

Added a type check to break.