Added check for wrong stream/buffer allocation

Description of changes: Fix prevents possible access to wrong stream
(if length=0 buffer will be NULL) during ico image decoding.

Change-Id: Ie4375079238ef9c9bd3deeb57ddf4c43045db11e