check for null/undefined session in addSessionData (#1698)

* check for null/undefined session in addSessionData

* Update sessions.js
This commit is contained in:
Zsolt Dollenstein 2017-04-28 17:40:32 -07:00 committed by Philippe Potvin
parent aa7e79a039
commit af21493e2b

View file

@ -53,23 +53,24 @@ export function addSessionData(uid, data) {
type: SESSION_ADD_DATA, type: SESSION_ADD_DATA,
data, data,
effect() { effect() {
const {shell} = getState().sessions.sessions[uid]; const session = getState().sessions.sessions[uid];
if (session) {
const enterKey = data.indexOf('\n') > 0; const enterKey = data.indexOf('\n') > 0;
const url = enterKey ? isUrl(shell, data) : null; const url = enterKey ? isUrl(session.shell, data) : null;
if (url) { if (url) {
dispatch({ return dispatch({
type: SESSION_URL_SET, type: SESSION_URL_SET,
uid, uid,
url url
}); });
} else { }
}
dispatch({ dispatch({
type: SESSION_PTY_DATA, type: SESSION_PTY_DATA,
uid, uid,
data data
}); });
} }
}
}); });
}; };
} }