Skip to content

Commit 74de533

Browse files
committed
fix bug when popularity list is empty
1 parent 3493991 commit 74de533

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

codepoints.net/lib/site_functions.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ function get_popular_codepoints(Database $db) : Array {
3131
}
3232
}
3333
$cps = [];
34-
$list = join(',', array_unique($intlist));
35-
$data = $db->getAll('SELECT cp, name, gc FROM codepoints
36-
WHERE cp IN ( '.$list.' ) ORDER BY FIELD( cp, '.$list.' )');
37-
if (is_array($data)) {
38-
foreach ($data as $set) {
34+
$db_data = null;
35+
if ($intlist) {
36+
$list = join(',', array_unique($intlist));
37+
$db_data = $db->getAll('SELECT cp, name, gc FROM codepoints
38+
WHERE cp IN ( '.$list.' ) ORDER BY FIELD( cp, '.$list.' )');
39+
}
40+
if (is_array($db_data)) {
41+
foreach ($db_data as $set) {
3942
$candidate = Codepoint::getCached($set, $db);
4043
if ($candidate->sensitivity->value > SENSITIVITY_LEVEL::RAISED->value) {
4144
continue;

0 commit comments

Comments
 (0)