Corrected null pointer exception in allocating device print