comparison mod_smacks/mod_smacks.lua @ 812:0095b74a3685

mod_smacks: Avoid indexing a nil value
author Kim Alvefur <zash@zash.se>
date Wed, 12 Sep 2012 18:03:55 +0200
parents e2d940d81613
children e089160c424b
comparison
equal deleted inserted replaced
811:e2d940d81613 812:0095b74a3685
223 -- We need to check the current resumption token for this resource 223 -- We need to check the current resumption token for this resource
224 -- matches the smacks session this timer is for in case it changed 224 -- matches the smacks session this timer is for in case it changed
225 -- (for example, the client may have bound a new resource and 225 -- (for example, the client may have bound a new resource and
226 -- started a new smacks session, or not be using smacks) 226 -- started a new smacks session, or not be using smacks)
227 local curr_session = full_sessions[session.full_jid]; 227 local curr_session = full_sessions[session.full_jid];
228 if curr_session.resumption_token == resumption_token 228 if curr_session and curr_session.resumption_token == resumption_token
229 -- Check the hibernate time still matches what we think it is, 229 -- Check the hibernate time still matches what we think it is,
230 -- otherwise the session resumed and re-hibernated. 230 -- otherwise the session resumed and re-hibernated.
231 and session.hibernating == hibernate_time then 231 and session.hibernating == hibernate_time then
232 session.log("debug", "Destroying session for hibernating too long"); 232 session.log("debug", "Destroying session for hibernating too long");
233 session_registry[session.resumption_token] = nil; 233 session_registry[session.resumption_token] = nil;