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