瀏覽代碼

[lua] throw eof properly in FileInput

closes #7544
Kevin Leung 7 年之前
父節點
當前提交
91ef180dd7
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      std/lua/_std/sys/io/FileInput.hx

+ 5 - 0
std/lua/_std/sys/io/FileInput.hx

@@ -67,6 +67,11 @@ class FileInput extends haxe.io.Input {
 		}
 		return NativeStringTools.byte(byte);
 	}
+			
+	override function readBytes( s : Bytes, pos : Int, len : Int ) : Int {
+		if(eof()) throw new haxe.io.Eof();
+		return super.readBytes(s, pos, len);
+	}
 
 	override inline public function close() : Void {
 		f.close();