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.
Merge remote-tracking branch 'splittingred/pr/267' into pr-267