CID 1237195: null deref when no project found
CLOUDSTACK-7404: Failed to start an instance when originating template has been deleted

Signed-off-by: Sebastien Goasguen <runseb@gmail.com>
(cherry picked from commit c1bf7eeeeeb3bd4dad384225d411e21859cce470)