Move check for non-existing reference count higher up

It doesn't make sense to check for negative numbers or 0 if the
value doesn't even exist. It ends up spamming the warning logs
prior to actually hitting the case we want.

Change-Id: I8f6cf17d4cd628fdcff13f2d29c7ae9661444de2
This commit is contained in:
Chad Horohoe 2016-05-05 12:09:33 -07:00
parent 06376669d9
commit 893db13b5c

View file

@ -806,7 +806,14 @@ class Cite {
$text
)->inContentLanguage()->plain();
}
if ( !isset( $val['count'] ) ) {
// this handles the case of section preview for list-defined references
return wfMessage( 'cite_references_link_many',
self::getReferencesKey( $key . "-" . $val['key'] ),
'',
$text
)->inContentLanguage()->plain();
}
if ( $val['count'] < 0 ) {
return wfMessage(
'cite_references_link_one',
@ -830,14 +837,6 @@ class Cite {
)->inContentLanguage()->plain();
// Named references with >1 occurrences
}
if ( !isset( $val['count'] ) ) {
// this handles the case of section preview for list-defined references
return wfMessage( 'cite_references_link_many',
self::getReferencesKey( $key . "-" . $val['key'] ),
'',
$text
)->inContentLanguage()->plain();
}
$links = array();
// for group handling, we have an extra key here.
for ( $i = 0; $i <= $val['count']; ++$i ) {