Skip to content

Commit a467517

Browse files
committed
BoxLang Compat for null checks
1 parent aa3dcf8 commit a467517

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

models/ValidationManager.cfc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ component accessors="true" serialize="false" singleton {
387387
*/
388388
struct function getSharedConstraints( string name ){
389389
return (
390-
structKeyExists( arguments, "name" ) ? variables.sharedConstraints[ arguments.name ] : variables.sharedConstraints
390+
structKeyExists( arguments, "name" ) && !isNull( arguments.name ) ? variables.sharedConstraints[
391+
arguments.name
392+
] : variables.sharedConstraints
391393
);
392394
}
393395

models/result/ValidationResult.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ component accessors="true" {
247247
array function getAllErrors( string field ){
248248
var errorTarget = variables.errors;
249249

250-
if ( structKeyExists( arguments, "field" ) ) {
250+
if ( structKeyExists( arguments, "field" ) && !isNull( arguments.field ) ) {
251251
errorTarget = getFieldErrors( arguments.field );
252252
}
253253

@@ -266,7 +266,7 @@ component accessors="true" {
266266
var errorTarget = variables.errors;
267267

268268
// filter by field?
269-
if ( structKeyExists( arguments, "field" ) ) {
269+
if ( structKeyExists( arguments, "field" ) && !isNull( arguments.field ) ) {
270270
errorTarget = getFieldErrors( arguments.field );
271271
}
272272

0 commit comments

Comments
 (0)