Fix IP sorting when there are empty fields present.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2020-05-18 21:22:26 +02:00
parent 7be091d76e
commit 128a88e130

View File

@@ -5,12 +5,18 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
// This code has been taken from
// The original ip-sorting code has been taken from
// https://datatables.net/plug-ins/sorting/ip-address
// and was modified by the Pi-hole team to support
// CIDR notation and be more robust against invalid
// input data (like empty IP addresses)
jQuery.extend(jQuery.fn.dataTableExt.oSort, {
"ip-address-pre": function (a) {
if (!a) {
return 0;
// Skip empty fields (IP address might have expired or
// reassigned to a differenct device)
if (!a || a.length === 0) {
return Infinity;
}
var i, item;