[bim] Bail early trying to edit a directory
This commit is contained in:
parent
06a7ca8cd9
commit
991fb36690
@ -2825,11 +2825,16 @@ void open_file(char * file) {
|
||||
|
||||
state = 0;
|
||||
|
||||
while (!feof(f)) {
|
||||
while (!feof(f) && !ferror(f)) {
|
||||
size_t r = fread(buf, 1, BLOCK_SIZE, f);
|
||||
add_buffer(buf, r);
|
||||
}
|
||||
|
||||
if (ferror(f)) {
|
||||
env->loading = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (env->line_no && env->lines[env->line_no-1] && env->lines[env->line_no-1]->actual == 0) {
|
||||
/* Remove blank line from end */
|
||||
remove_line(env->lines, env->line_no-1);
|
||||
|
Loading…
Reference in New Issue
Block a user