From c280f6ca11dbd374c738aebf069f44de60ee9581 Mon Sep 17 00:00:00 2001 From: James Cordrey Date: Fri, 10 Jun 2022 21:11:50 -0500 Subject: [PATCH 1/2] Updated internal Picker constructor to set parentId to -1 if it is null, as member types, for example, do not have a parentId. --- source/nuPickers/Picker.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/nuPickers/Picker.cs b/source/nuPickers/Picker.cs index 0831bd6..2125947 100644 --- a/source/nuPickers/Picker.cs +++ b/source/nuPickers/Picker.cs @@ -98,10 +98,10 @@ public Picker(int contextId, string propertyAlias, bool usePublishedValue = true /// the dataType id of this picker /// the alias of the dataType /// the actual value saved - internal Picker(int contextId, int parentId, string propertyAlias, int dataTypeId, string propertyEditorAlias, object savedValue) + internal Picker(int contextId, int? parentId, string propertyAlias, int dataTypeId, string propertyEditorAlias, object savedValue) { this.ContextId = contextId; - this.ParentId = parentId; + this.ParentId = parentId == null ? -1 : (int)parentId; this.PropertyAlias = propertyAlias; this.DataTypeId = dataTypeId; this.PropertyEditorAlias = propertyEditorAlias; From 372d9c1e5826553e0efe70c2931e7e3166bd6ebe Mon Sep 17 00:00:00 2001 From: James Cordrey Date: Fri, 10 Jun 2022 22:48:58 -0500 Subject: [PATCH 2/2] Updated ternary to match style and logic of Public Constructor. --- source/nuPickers/Picker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/nuPickers/Picker.cs b/source/nuPickers/Picker.cs index 2125947..416a1b8 100644 --- a/source/nuPickers/Picker.cs +++ b/source/nuPickers/Picker.cs @@ -101,7 +101,7 @@ public Picker(int contextId, string propertyAlias, bool usePublishedValue = true internal Picker(int contextId, int? parentId, string propertyAlias, int dataTypeId, string propertyEditorAlias, object savedValue) { this.ContextId = contextId; - this.ParentId = parentId == null ? -1 : (int)parentId; + this.ParentId = (parentId != null) ? (int)parentId : -1; this.PropertyAlias = propertyAlias; this.DataTypeId = dataTypeId; this.PropertyEditorAlias = propertyEditorAlias;