B2023-049: Null reference crash on Paste Before

This commit is contained in:
2023-05-11 13:12:23 +00:00
parent 56261de1bb
commit 69fec106f7

View File

@@ -597,6 +597,13 @@ namespace VEPROMS.CSLA.Library
public static bool CheckSourceDestinationType(int copyStartID, ItemInfo itemInfo)
{
ItemInfo cpyItem = ItemInfo.Get(copyStartID);
// B2023-049: crash when copied step is no longer available (may have been deleted in previous operation)
if (cpyItem == null)
{
DialogResult msgBoxResult = FlexibleMessageBox.Show("The step you are pasting no longer exists - it may have been deleted as part of a previous operation.", "Paste Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
// B2017-065 use MyContent instead of _Mycontent so that if null it will get the needed content
int? SourceType = cpyItem.MyContent.Type;
int? DestType = itemInfo.MyContent.Type;