Fixed bug: if an error was found retrieving layers, it still tried to return layers, and failed with an NPE.
We handle the case in which the user is not logged.