Skip to content

Commit 597b2cb

Browse files
committed
bugfix defaultvalue
1 parent 9cc14c4 commit 597b2cb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

EDSEditorGUI/DeviceODView.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,17 @@ private void ObjectSave()
543543

544544
bool setDefaultValueToAll = false;
545545
bool identicalDefaultValues = true;
546-
546+
string lastdefaultvalue;
547547
if (od.parent != null && od.parent.Nosubindexes > 2)
548548
{
549-
550-
for (int i = 2; i < od.parent.Nosubindexes; i++)
549+
lastdefaultvalue = od.parent.subobjects[1].defaultvalue;
550+
foreach (ODentry subod in od.parent.subobjects.Values)
551551
{
552-
identicalDefaultValues &= ((od.parent.subobjects[(ushort)i].defaultvalue == od.parent.subobjects[(ushort)(i - 1)].defaultvalue) && (od.parent.subobjects[(ushort)i].defaultvalue != textBox_defaultValue.Text));
552+
if (subod.Subindex > 0)
553+
{
554+
identicalDefaultValues &= (subod.defaultvalue == lastdefaultvalue)&& (subod.defaultvalue != textBox_defaultValue.Text);
555+
lastdefaultvalue = subod.defaultvalue;
556+
}
553557
}
554558

555559
if (identicalDefaultValues) {

0 commit comments

Comments
 (0)