Fix finally NPE

This commit is contained in:
Kegan Dougal 2016-01-20 15:38:34 +00:00
parent 8dc21ec837
commit b296d05b35

View file

@ -118,15 +118,11 @@ module.exports = React.createClass({
if (!this.state.room) { if (!this.state.room) {
if (this.props.autoPeek) { if (this.props.autoPeek) {
console.log("Attempting to peek into room %s", this.props.roomId); console.log("Attempting to peek into room %s", this.props.roomId);
MatrixClientPeg.get().peekInRoom(this.props.roomId).done(() => { MatrixClientPeg.get().peekInRoom(this.props.roomId).catch((err) => {
// we don't need to do anything - JS SDK will emit Room events
// which will update the UI. We *do* however need to know if we
// can join the room so we can fiddle with the UI appropriately.
// ...XXX: or do we? can't we just do them onNewRoom?
}, function(err) {
console.error("Failed to peek into room: %s", err); console.error("Failed to peek into room: %s", err);
}).finally(() => { }).finally(() => {
// we don't need to do anything - JS SDK will emit Room events
// which will update the UI.
this.setState({ this.setState({
autoPeekDone: true autoPeekDone: true
}); });