File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -660,6 +660,10 @@ public function setError(string $error): void
660
660
*/
661
661
public function readSHP (int $ bytes )
662
662
{
663
+ if ($ this ->shpFile === null ) {
664
+ return false ;
665
+ }
666
+
663
667
return fread ($ this ->shpFile , $ bytes );
664
668
}
665
669
Original file line number Diff line number Diff line change @@ -109,6 +109,16 @@ public function testLoadError(string $filename): void
109
109
$ this ->assertNotEquals ('' , $ shp ->lastError );
110
110
}
111
111
112
+ /**
113
+ * Test load an empty file name
114
+ */
115
+ public function testLoadEmptyFilename (): void
116
+ {
117
+ $ shp = new ShapeFile (1 );
118
+ $ shp ->loadFromFile ('' );
119
+ $ this ->assertEquals ('Not a SHP file (file code mismatch) ' , $ shp ->lastError );
120
+ }
121
+
112
122
/**
113
123
* Data provider for file loading error tests.
114
124
*
You can’t perform that action at this time.
0 commit comments