Преглед изворни кода

Handle optional allocator error when appending read bytes in read_entire_file_from_file

Damian Tarnawski пре 1 недеља
родитељ
комит
cdca345d74
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      core/os/os2/file_util.odin

+ 1 - 1
core/os/os2/file_util.odin

@@ -151,7 +151,7 @@ read_entire_file_from_file :: proc(f: ^File, allocator: runtime.Allocator) -> (d
 			n: int
 			n, err = read(f, buffer[:])
 			total += n
-			append_elems(&out_buffer, ..buffer[:n])
+			append_elems(&out_buffer, ..buffer[:n]) or_return
 			if err != nil {
 				if err == .EOF || err == .Broken_Pipe {
 					err = nil