diff options
Diffstat (limited to 'lib/JWebmail/Plugin')
-rw-r--r-- | lib/JWebmail/Plugin/ServerSideSessionData.pm | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/JWebmail/Plugin/ServerSideSessionData.pm b/lib/JWebmail/Plugin/ServerSideSessionData.pm index 40772eb..94e8f25 100644 --- a/lib/JWebmail/Plugin/ServerSideSessionData.pm +++ b/lib/JWebmail/Plugin/ServerSideSessionData.pm @@ -120,10 +120,9 @@ sub s3d { $c->session(S_KEY, $file->basename); } - my $data = decode_json($file->slurp) if (-s $file); + my $data = -s $file ? decode_json($file->slurp) : {}; if (defined $val) { # set - $data = ref $data ? $data : {}; $data->{$key} = $val; $file->spurt(encode_json $data, "\n"); |