[5.0] Only Set The Session If It's Not Null

Fix regarding https://github.com/laravel/framework/commit/3a06c91468cc2453a82590208c06bd4037c421f4#commitcomment-8475036.