FormatMetadata::formatFraction: Don't risk passing null to preg_match
We do this above for formatNum(), so this approach seems to be idiomatic to this code. Bug: T394989 Change-Id: I804cc180e5de8ddf22b70e9f532f0f2416713eb7 (cherry picked from commit a6a777ae853f0f989b1438bd5c1c3af5dbed135a)
This commit is contained in:
parent
4c2a44d9e0
commit
700a639140
1 changed files with 1 additions and 0 deletions
|
|
@ -1378,6 +1378,7 @@ class FormatMetadata extends ContextSource {
|
|||
*/
|
||||
private function formatFraction( $num ) {
|
||||
$m = [];
|
||||
$num ??= '';
|
||||
if ( preg_match( '/^(-?\d+)\/(\d+)$/', $num, $m ) ) {
|
||||
$numerator = (int)$m[1];
|
||||
$denominator = (int)$m[2];
|
||||
|
|
|
|||
Loading…
Reference in a new issue