Merge pull request #14883 from owncloud/imagepng_expects_resource_issue
validate resource's integrity before using it
This commit is contained in:
commit
1075914f8a
|
@ -283,9 +283,12 @@ class OC_Image {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return string Returns the raw image data.
|
||||
* @return null|string Returns the raw image data.
|
||||
*/
|
||||
function data() {
|
||||
if (!$this->valid()) {
|
||||
return null;
|
||||
}
|
||||
ob_start();
|
||||
switch ($this->mimeType) {
|
||||
case "image/png":
|
||||
|
|
|
@ -144,6 +144,11 @@ class Test_Image extends \Test\TestCase {
|
|||
$this->assertEquals($expected, $img->data());
|
||||
}
|
||||
|
||||
public function testDataNoResource() {
|
||||
$img = new \OC_Image();
|
||||
$this->assertNull($img->data());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testData
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue