Jonaskeutel has uploaded a new change for review.
https://gerrit.wikimedia.org/r/217253
Change subject: add check for somevalue that caused crash in
diffWithinRangeChecker
......................................................................
add check for somevalue that caused crash in diffWithinRangeChecker
Change-Id: Ib4d77406e4d2931dab88fffccdcab3e285e9e5c1
---
M includes/ConstraintCheck/Checker/DiffWithinRangeChecker.php
1 file changed, 5 insertions(+), 1 deletion(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataQualityConstraints
refs/changes/53/217253/1
diff --git a/includes/ConstraintCheck/Checker/DiffWithinRangeChecker.php
b/includes/ConstraintCheck/Checker/DiffWithinRangeChecker.php
index 23417a7..dadbf68 100644
--- a/includes/ConstraintCheck/Checker/DiffWithinRangeChecker.php
+++ b/includes/ConstraintCheck/Checker/DiffWithinRangeChecker.php
@@ -108,6 +108,10 @@
* error handling:
* types of this and the other value have to
be equal, both must contain actual values
*/
+ if ( !$mainSnak instanceof PropertyValueSnak ) {
+ $message = 'Referenced property needs
to have a value.';
+ return new CheckResult( $statement,
$constraint->getConstraintTypeQid(), $parameters,
CheckResult::STATUS_VIOLATION, $message );
+ }
if ( $mainSnak->getDataValue()->getType() ===
$dataValue->getType() && $mainSnak->getType() === 'value' ) {
$thatValue =
$this->rangeCheckerHelper->getComparativeValue( $mainSnak->getDataValue() );
@@ -134,4 +138,4 @@
$status = CheckResult::STATUS_VIOLATION;
return new CheckResult( $statement,
$constraint->getConstraintTypeQid(), $parameters, $status, $message );
}
-}
\ No newline at end of file
+}
--
To view, visit https://gerrit.wikimedia.org/r/217253
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4d77406e4d2931dab88fffccdcab3e285e9e5c1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Jonaskeutel <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits