1 parent ebef1ed commit 121846eCopy full SHA for 121846e
1 file changed
Torch.Server/ViewModels/Entities/EntityViewModel.cs
@@ -85,9 +85,20 @@ public virtual string GetSortedName(EntityTreeViewModel.SortEnum sort)
85
86
public virtual int CompareToSort(EntityViewModel other, EntityTreeViewModel.SortEnum sort)
87
{
88
+ if (other == null)
89
+ return -1;
90
+
91
switch (sort)
92
93
case EntityTreeViewModel.SortEnum.Name:
94
+ if (Name == null)
95
+ {
96
+ if (other.Name == null)
97
+ return 0;
98
+ return 1;
99
+ }
100
101
102
return string.Compare(Name, other.Name, StringComparison.InvariantCultureIgnoreCase);
103
case EntityTreeViewModel.SortEnum.Size:
104
return Entity.WorldVolume.Radius.CompareTo(other.Entity.WorldVolume.Radius);
0 commit comments