[Pkg-owncloud-commits] [owncloud] 56/118: validate resource's integrity before using it
David Prévot
taffit at moszumanska.debian.org
Fri Mar 27 22:13:12 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit bc5ca788162ea66bc90d0fbe0bcaacd02d6617b9
Author: Georg Ehrke <developer at georgehrke.com>
Date: Fri Mar 13 17:23:02 2015 +0100
validate resource's integrity before using it
---
lib/private/image.php | 5 ++++-
tests/lib/image.php | 5 +++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/private/image.php b/lib/private/image.php
index 317b6fd..2484aee 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -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":
diff --git a/tests/lib/image.php b/tests/lib/image.php
index e0009b9..0ee5171 100644
--- a/tests/lib/image.php
+++ b/tests/lib/image.php
@@ -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
*/
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list