From 234b470892eab96675e2fe4a04fe9b50b0e1ba6a Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Mon, 3 May 2021 14:31:20 +0000 Subject: [PATCH] Allow file size plugin to work with empty strings Fix #521 --- sorting/file-size.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sorting/file-size.js b/sorting/file-size.js index 2793244..5d3b90b 100644 --- a/sorting/file-size.js +++ b/sorting/file-size.js @@ -19,6 +19,10 @@ */ jQuery.fn.dataTable.ext.type.order['file-size-pre'] = function ( data ) { + if (data === null || data === '') { + return 0; + } + var matches = data.match( /^(\d+(?:\.\d+)?)\s*([a-z]+)/i ); var multipliers = { b: 1,