Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 2f78283

Browse files
committed
Snapline -> Null Ref fix
1 parent 78fe8ec commit 2f78283

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,13 @@ private IEnumerable<DesignItem> AllDesignItems(DesignItem designItem = null)
184184
{
185185
designItem = this.ExtendedItem.Services.DesignPanel.Context.RootItem;
186186
yield return designItem;
187-
yield return designItem.ContentProperty.Value;
188-
designItem = designItem.ContentProperty.Value;
187+
if (designItem.ContentProperty.Value != null) {
188+
yield return designItem.ContentProperty.Value;
189+
designItem = designItem.ContentProperty.Value;
190+
}
189191
}
190-
//yield return designItem.ContentProperty.Value;
191192

192-
if (designItem.ContentProperty.IsCollection)
193+
if (designItem.ContentProperty != null && designItem.ContentProperty.IsCollection)
193194
foreach (var collectionElement in designItem.ContentProperty.CollectionElements)
194195
{
195196
yield return collectionElement;
@@ -212,13 +213,14 @@ void BuildMaps(PlacementOperation operation)
212213
AddLines(containerRect, 0, false);
213214

214215
foreach (var item in AllDesignItems() /* ExtendedItem.ContentProperty.CollectionElements */
215-
.Except(operation.PlacedItems.Select(f => f.Item)))
216-
{
217-
var bounds = GetPosition(operation, item);
216+
.Except(operation.PlacedItems.Select(f => f.Item))) {
217+
if (item != null) {
218+
var bounds = GetPosition(operation, item);
218219

219-
AddLines(bounds, 0, false);
220-
AddLines(bounds, Margin, true);
221-
AddBaseline(item, bounds, horizontalMap);
220+
AddLines(bounds, 0, false);
221+
AddLines(bounds, Margin, true);
222+
AddBaseline(item, bounds, horizontalMap);
223+
}
222224
}
223225
}
224226

0 commit comments

Comments
 (0)