summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-08-09 12:24:40 -0300
committerpommicket <pommicket@gmail.com>2023-08-09 12:25:33 -0300
commit310faf5d70b8a65c83c013a31ab87d9d3f301767 (patch)
tree9e48b8afad2651de90e6b4e74ac9b96d94968fbd /buffer.c
parent17e65f8dd57762a2e79aeb79a5c0fb69849c07f9 (diff)
new node/buffer system, needs more testing
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 8e1bbfb..1c33f99 100644
--- a/buffer.c
+++ b/buffer.c
@@ -804,6 +804,8 @@ static void buffer_line_free(Line *line) {
}
void buffer_free(TextBuffer *buffer) {
+ if (!buffer) return;
+
if (!buffer->ted->quit) { // don't send didClose on quit (calling buffer_lsp would actually create a LSP if this is called after destroying all the LSPs which isnt good)
LSP *lsp = buffer_lsp(buffer);
@@ -2647,6 +2649,10 @@ void buffer_paste(TextBuffer *buffer) {
// if an error occurs, buffer is left untouched (except for the error field) and the function returns false.
Status buffer_load_file(TextBuffer *buffer, const char *path) {
+ if (!unicode_is_valid_utf8(path)) {
+ buffer_error(buffer, "Path is not valid UTF8.");
+ return false;
+ }
if (!path || !path_is_absolute(path)) {
buffer_error(buffer, "Loaded path '%s' is not an absolute path.", path);
return false;