Supporting galleries with less than 3 photos

Galleries with < 3 photos break. This addition come to treat the Obj Error, when it does not exist (thus breaks the code)