diff options
| author | jixiuf <jixiuf@qq.com> | 2019-08-05 15:34:20 +0800 |
|---|---|---|
| committer | jixiuf <jixiuf@qq.com> | 2019-08-05 15:36:02 +0800 |
| commit | 73f5044bd9fa0dc1755078905a59b64f14fe6bfd (patch) | |
| tree | 3eb18452181d7e394f3d767edf8df93377dffda3 | |
| parent | 887025823b22a3ca5cdaacbba6e0bf771a68b154 (diff) | |
fix panic for directory tracking,donot known why ,it would panic on my mac when I change directory.
| -rw-r--r-- | vterm-module.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/vterm-module.c b/vterm-module.c index 21ace5f..7565721 100644 --- a/vterm-module.c +++ b/vterm-module.c @@ -652,12 +652,11 @@ static int osc_callback(const char *command, size_t cmdlen, void *user) buffer[cmdlen] = '\0'; memcpy(buffer, command, cmdlen); - if (term->directory != NULL) { - free(term->directory); - term->directory = NULL; - } - if (cmdlen > 3 && buffer[0] == '5' && buffer[1] == '1' && buffer[2] == ';') { + if (term->directory != NULL) { + free(term->directory); + term->directory = NULL; + } term->directory = malloc(cmdlen - 3 + 1); strcpy(term->directory, &buffer[3]); term->directory_changed = true; |
