add protection (emoty object) when accessing id after declaring an object. (#1970)
This commit is contained in:
parent
cf85c3c1e8
commit
c1317f0e94
5 changed files with 5 additions and 5 deletions
|
|
@ -15,7 +15,7 @@ function makeMapStateToProps() {
|
|||
const getProfilesByIdsAndUsernames = makeGetProfilesByIdsAndUsernames();
|
||||
|
||||
return (state, ownProps) => {
|
||||
const currentUser = getCurrentUser(state);
|
||||
const currentUser = getCurrentUser(state) || {};
|
||||
const {allUserIds, allUsernames} = ownProps;
|
||||
return {
|
||||
currentUserId: currentUser.id,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {getCurrentTeam, getMyTeamsCount, getChannelDrawerBadgeCount} from 'matte
|
|||
import SwitchTeamsButton from './switch_teams_button';
|
||||
|
||||
function mapStateToProps(state) {
|
||||
const team = getCurrentTeam(state);
|
||||
const team = getCurrentTeam(state) || {};
|
||||
|
||||
return {
|
||||
currentTeamId: team.id,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {getDimensions} from 'app/selectors/device';
|
|||
import SettingsSidebar from './settings_sidebar';
|
||||
|
||||
function mapStateToProps(state) {
|
||||
const currentUser = getCurrentUser(state);
|
||||
const currentUser = getCurrentUser(state) || {};
|
||||
const status = getStatusForUserId(state, currentUser.id);
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import NotificationSettings from './notification_settings';
|
|||
|
||||
function mapStateToProps(state) {
|
||||
const config = getConfig(state);
|
||||
const currentUser = getCurrentUser(state);
|
||||
const currentUser = getCurrentUser(state) || {};
|
||||
const currentUserStatus = getStatusForUserId(state, currentUser.id);
|
||||
const serverVersion = state.entities.general.serverVersion;
|
||||
const enableAutoResponder = isMinimumServerVersion(serverVersion, 4, 9) && config.ExperimentalEnableAutomaticReplies === 'true';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import Timezone from './timezone';
|
|||
|
||||
function mapStateToProps(state) {
|
||||
const timezones = getTimezones(state);
|
||||
const currentUser = getCurrentUser(state);
|
||||
const currentUser = getCurrentUser(state) || {};
|
||||
const userTimezone = getUserTimezone(state, currentUser.id);
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in a new issue