JorgenPhi / php-snapchat

A PHP library for the Snapchat API - With Commit History
MIT License
259 stars 73 forks source link

Check for login before pulling from cache, resolving fatal errors #93

Open jrgp opened 9 years ago

jrgp commented 9 years ago

Currently, if login fails and you try getSnaps() or any of the other get functions, it will call getUpdates() which calls $this->cache->get() before checking for a valid login.

As $this->cache is not populated until a valid login, this will cause this sort of error:

Fatal error: Call to a member function get() on a non-object in /homepages/15/d419114431/htdocs/bobink/snapchat/src/snapchat.php on line 234

This change modifies the code to perform the login check before pulling from cache, solving the fatal errors.