fix nullguard on EventTile, getComponent never returns falsey, it throws

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2018-06-27 11:44:11 +01:00
parent a0871116d8
commit 55f4f1723d
No known key found for this signature in database
GPG key ID: 3F879DA5AD802A5E

View file

@ -484,12 +484,14 @@ module.exports = withMatrixClient(React.createClass({
// Info messages are basically information about commands processed on a room // Info messages are basically information about commands processed on a room
const isInfoMessage = (eventType !== 'm.room.message' && eventType !== 'm.sticker'); const isInfoMessage = (eventType !== 'm.room.message' && eventType !== 'm.sticker');
const EventTileType = sdk.getComponent(getHandlerTile(this.props.mxEvent)); const tileHandler = getHandlerTile(this.props.mxEvent);
// This shouldn't happen: the caller should check we support this type // This shouldn't happen: the caller should check we support this type
// before trying to instantiate us // before trying to instantiate us
if (!EventTileType) { if (!tileHandler) {
throw new Error("Event type not supported"); const {mxEvent} = this.props;
throw new Error(`Event type not supported: type:${mxEvent.getType()} isState:${mxEvent.isState()}`);
} }
const EventTileType = sdk.getComponent(tileHandler);
const isSending = (['sending', 'queued', 'encrypting'].indexOf(this.props.eventSendStatus) !== -1); const isSending = (['sending', 'queued', 'encrypting'].indexOf(this.props.eventSendStatus) !== -1);
const isRedacted = isMessageEvent(this.props.mxEvent) && this.props.isRedacted; const isRedacted = isMessageEvent(this.props.mxEvent) && this.props.isRedacted;