You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
Assume the position is at the end when the offset has no last part
We get an NPE when the user cuts their entire message, and this fixes it.
This commit is contained in:
@@ -117,7 +117,7 @@ export default class DocumentPosition {
|
||||
}
|
||||
offset += this.offset;
|
||||
const lastPart = model.parts[this.index];
|
||||
const atEnd = offset >= lastPart.text.length;
|
||||
const atEnd = !lastPart || offset >= lastPart.text.length; // if no last part, we're at the end
|
||||
return new DocumentOffset(offset, atEnd);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user