@@ -1597,14 +1597,15 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
15971597 } ;
15981598
15991599 private injectSticker ( url : string , info : object , text : string , threadId : string | null ) : void {
1600- if ( ! this . context . client ) return ;
1600+ const roomId = this . getRoomId ( ) ;
1601+ if ( ! this . context . client || ! roomId ) return ;
16011602 if ( this . context . client . isGuest ( ) ) {
16021603 dis . dispatch ( { action : "require_registration" } ) ;
16031604 return ;
16041605 }
16051606
16061607 ContentMessages . sharedInstance ( )
1607- . sendStickerContentToRoom ( url , this . getRoomId ( ) , threadId , info , text , this . context . client )
1608+ . sendStickerContentToRoom ( url , roomId , threadId , info , text , this . context . client )
16081609 . then ( undefined , ( error ) => {
16091610 if ( error . name === "UnknownDeviceError" ) {
16101611 // Let the staus bar handle this
@@ -1636,7 +1637,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
16361637 private onSearchUpdate = ( inProgress : boolean , searchResults : ISearchResults | null ) : void => {
16371638 this . setState ( {
16381639 search : {
1639- ...this . state . search ,
1640+ ...this . state . search ! ,
16401641 count : searchResults ?. count ,
16411642 inProgress,
16421643 } ,
@@ -1658,10 +1659,12 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
16581659 } ;
16591660
16601661 private onRejectButtonClicked = ( ) : void => {
1662+ const roomId = this . getRoomId ( ) ;
1663+ if ( ! roomId ) return ;
16611664 this . setState ( {
16621665 rejecting : true ,
16631666 } ) ;
1664- this . context . client ?. leave ( this . getRoomId ( ) ) . then (
1667+ this . context . client ?. leave ( roomId ) . then (
16651668 ( ) => {
16661669 dis . dispatch ( { action : Action . ViewHomePage } ) ;
16671670 this . setState ( {
@@ -1896,14 +1899,17 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
18961899 } ) ;
18971900 }
18981901
1899- private onFileDrop = ( dataTransfer : DataTransfer ) : Promise < void > =>
1900- ContentMessages . sharedInstance ( ) . sendContentListToRoom (
1902+ private onFileDrop = async ( dataTransfer : DataTransfer ) : Promise < void > => {
1903+ const roomId = this . getRoomId ( ) ;
1904+ if ( ! roomId || ! this . context . client ) return ;
1905+ await ContentMessages . sharedInstance ( ) . sendContentListToRoom (
19011906 Array . from ( dataTransfer . files ) ,
1902- this . getRoomId ( ) ,
1903- null ,
1907+ roomId ,
1908+ undefined ,
19041909 this . context . client ,
19051910 TimelineRenderingType . Room ,
19061911 ) ;
1912+ } ;
19071913
19081914 private onMeasurement = ( narrow : boolean ) : void => {
19091915 this . setState ( { narrow } ) ;
0 commit comments