# gpui: Handle null string pointer in \`window::insert_text\` \(\#12446\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/be2df79d5caf8db7252d8843b83ad218b616b63f)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: be2df79d5caf8db7252d8843b83ad218b616b63f

Requested commit: be2df79d5caf8db7252d8843b83ad218b616b63f

Commit: be2df79d5caf8db7252d8843b83ad218b616b63f

Tree: 8b748e12505abf7129fe270727c2f3a1fc391c4b

Author: Sean Billig

Committer: GitHub

## Message

```
gpui: Handle null string pointer in `window::insert_text` (#12446)

`[NSString UTF8String]` sometimes returns null (it's documented as
such), and when it does, zed crashes in `window::insert_text`. I'm
running into this sometimes when using alt-d to delete forward. It
usually only happens with multiple cursors, but sometimes with a single
cursor. It *might* only happen when using the "Unicode Hex Input"
keyboard 'Input Source' (which I started using to avoid entering weird
characters in zed when using emacs meta keybindings that I haven't
defined in zed).

When using the US English input source, alt-d always results in a call
to `insert_text`. When using the Unicode Hex Input source it usually
doesn't, but when it does `text.UTF8String()` returns null. `text` isn't
null. `[text length]` returns 1. `[text characterAtIndex: 0]` seems to
always return `56797` (an undefined utf-16 codepoint).

Release Notes:

- Fixed crash on mac when deleting with alt-d
```

## Parents

- [344e5e1cf23e79da097b2606fe222073122b30c0](https://git.cafe/gitcafe/zed/commit/344e5e1cf23e79da097b2606fe222073122b30c0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/be2df79d5caf8db7252d8843b83ad218b616b63f?format=markdown)
