Check for allocation = NULL. This fixes a segfault during applet load

This was tested on top of the 1.8 version on Mint Qiana