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,22 +53,23 @@ 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];
const enterKey = data.indexOf('\n') > 0; if (session) {
const url = enterKey ? isUrl(shell, data) : null; const enterKey = data.indexOf('\n') > 0;
if (url) { const url = enterKey ? isUrl(session.shell, data) : null;
dispatch({ if (url) {
type: SESSION_URL_SET, return dispatch({
uid, type: SESSION_URL_SET,
url uid,
}); url
} else { });
dispatch({ }
type: SESSION_PTY_DATA,
uid,
data
});
} }
dispatch({
type: SESSION_PTY_DATA,
uid,
data
});
} }
}); });
}; };