Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for dot notation handling null objects #39

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion media/js/jquery.dataTables.js
Expand Up @@ -6769,12 +6769,17 @@
if ( a.length == 2 )
{
return function (data) {
return data[ a[0] ][ a[1] ];
// Ensure we catch nulls in the chain
return (data[ a[0] ] == null) ? null : data[ a[0] ][ a[1] ];
};
}
else if ( a.length == 3 )
{
return function (data) {
// Ensure we catch nulls in the chain
if (data[ a[0] ] == null || data[ a[0] ][ a[1] ] == null){
return null;
}
return data[ a[0] ][ a[1] ][ a[2] ];
};
}
Expand All @@ -6784,6 +6789,10 @@
for ( var i=0, iLen=a.length ; i<iLen ; i++ )
{
data = data[ a[i] ];
// Ensure we catch nulls in the chain
if (data == null) {
return null;
}
}
return data;
};
Expand Down