mirror of
https://github.com/celisej567/LibBSP.git
synced 2026-09-11 20:09:36 +03:00
Fix exception if the BSP we're trying to read is actually too small to read.
This commit is contained in:
@@ -311,6 +311,9 @@ namespace LibBSP {
|
||||
private MapType GetVersion(bool bigEndian) {
|
||||
MapType current = MapType.Undefined;
|
||||
using (FileStream stream = new FileStream(bspFile.FullName, FileMode.Open, FileAccess.Read)) {
|
||||
if (stream.Length < 4) {
|
||||
return current;
|
||||
}
|
||||
BinaryReader binaryReader = new BinaryReader(stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
int num = binaryReader.ReadInt32();
|
||||
|
||||
Reference in New Issue
Block a user