Skip to content

Commit

Permalink
Merge pull request matrix-org#755 from matrix-org/travis/fix-vuln-war…
Browse files Browse the repository at this point in the history
…ning

Default to a room version of 1 when there is no room create event
  • Loading branch information
bwindels committed Oct 8, 2018
2 parents 1395da6 + d9fe194 commit a4b2cc8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/models/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ utils.inherits(Room, EventEmitter);
*/
Room.prototype.getVersion = function() {
const createEvent = this.currentState.getStateEvents("m.room.create", "");
if (!createEvent) return null;
if (!createEvent) {
console.warn("Room " + this.room_id + " does not have an m.room.create event");
return '1';
}
const ver = createEvent.getContent()['room_version'];
if (ver === undefined) return '1';
return ver;
Expand Down

0 comments on commit a4b2cc8

Please sign in to comment.