B2017-248 If a sibling Table, Figure or Equation has a sub-table or figure or equation, the code would crash when trying to display it. The code was changed to use the MyParent property which is never null rather than the MyParentEditItem property which can be null.

This commit is contained in:
Rich 2017-10-31 17:50:53 +00:00
parent 9558e3a81a
commit a201611858

View File

@ -2165,21 +2165,11 @@ namespace Volian.Controls.Library
protected Point TableLocation(StepSectionLayoutData myStepSectionLayoutData, int width)
{
// bug fix: B2016-111 - myParentEditItem was getting a null reference error when inserting a figure before/after a figure
EditItem myParentEditItem = _MyParentEditItem;
if (myParentEditItem == null)
{
EditItem parentEI = _MyPreviousEditItem;
while (parentEI._MyPreviousEditItem != null)
parentEI = parentEI._MyPreviousEditItem;
myParentEditItem = parentEI._MyParentEditItem;
}
EditItem myParentEditItem = MyParent;
// Should center on parent unless it is a centered table type in the AER column or parent is another table type, then
// walk up until finding a non-table type step'. (B2016-264: insert of centered eq off centered eq was not locating child equation correctly)
EditItem aboveForLocation = myParentEditItem;
if (aboveForLocation.MyItemInfo.IsTable || aboveForLocation.MyItemInfo.IsRtfRaw || aboveForLocation.MyItemInfo.IsFigure)
{
while (aboveForLocation.MyItemInfo.IsFigure || aboveForLocation.MyItemInfo.IsRtfRaw || aboveForLocation.MyItemInfo.IsTable) aboveForLocation = aboveForLocation.MyParentEditItem;
}
while (aboveForLocation.MyItemInfo.IsFigure || aboveForLocation.MyItemInfo.IsRtfRaw || aboveForLocation.MyItemInfo.IsTable) aboveForLocation = aboveForLocation.MyParent;// B2017-248
int center = aboveForLocation.ContentLeft + aboveForLocation.ContentWidth / 2;
int rightLimit = aboveForLocation.Right;