From b9a6db3ef3ce1c9c857fbc2be9c4a78696cc5f36 Mon Sep 17 00:00:00 2001 From: miodragbogdanovic Date: Wed, 7 Mar 2018 16:18:59 +0100 Subject: [PATCH 1/2] IP address field is empty bug I'm using this plugin, and I'm getting the exception when this field is empty (null). One checking line on the beginning solved this problem for me. --- sorting/ip-address.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sorting/ip-address.js b/sorting/ip-address.js index 28ff323..c5d0716 100644 --- a/sorting/ip-address.js +++ b/sorting/ip-address.js @@ -18,6 +18,7 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { "ip-address-pre": function ( a ) { + if (a == null) { return 0 } var i, item; var m = a.split("."), n = a.split(":"), @@ -100,4 +101,4 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { "ip-address-desc": function ( a, b ) { return ((a < b) ? 1 : ((a > b) ? -1 : 0)); } -}); \ No newline at end of file +}); From 768b29279b844fc52b3364fecca2e95a56fe08ef Mon Sep 17 00:00:00 2001 From: miodragbogdanovic Date: Thu, 8 Mar 2018 10:34:11 +0100 Subject: [PATCH 2/2] Update IP field is empty bug @Datatables, you are right, it should be better to use !a, then empty string case is covered as well. And yes, I'm happy for this to be included under MIT licence. --- sorting/ip-address.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorting/ip-address.js b/sorting/ip-address.js index c5d0716..48c1398 100644 --- a/sorting/ip-address.js +++ b/sorting/ip-address.js @@ -18,7 +18,7 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { "ip-address-pre": function ( a ) { - if (a == null) { return 0 } + if (!a) { return 0 } var i, item; var m = a.split("."), n = a.split(":"),