validate resource's integrity before using it

remotes/origin/etag-endpoint
Georg Ehrke 9 years ago
parent 0d9f149dd9
commit 09b05373ed

@ -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…
Cancel
Save