ID 233078 - Duplicating a MaterialStack entry while in edit mode, fails with an error

Follow

Problem summary
If you try to duplicate an existing entry in the MaterialStack node while in edit mode but not preview mode, an error appears and the duplication process fails.

Steps to reproduce
 
1. Open an empty Katana scene
2. Create a MaterialStack node and set the edit flag (green) on it but not the view flag (blue).
3. Choose Add -> Add Material
4. Right click on the newly created Material and choose Duplicate
 
The duplication fails with the following traceback:

[ERROR python.root]: An AttributeError occurred in "NodeExtensions.py": 'NoneType' object has no attribute 'isMarkedForDeletion'
    Traceback (most recent call last):
      File "bin/python/UI4/FormMaster/Editors/MaterialStack.py", line 532, in __duplicateMaterial
      File "bin/python/Nodes3DAPI/MaterialStack.py", line 535, in duplicateMaterial
      File "bin/python/Nodes3DAPI/MaterialStack.py", line 980, in MiniPaste
      File "bin/python/NodegraphAPI/NodeExtensions.py", line 409, in SetNodeViewed
    AttributeError: 'NoneType' object has no attribute 'isMarkedForDeletion'

Workaround
Unknown.

Reproduced by support

Reproduced on Linux in 2.5v3, 2.1v4, 2.0v3 and 2.0v1.  Also reproduced in 1.6v3 however the traceback is different:
 
[ERROR python.root]: An AttributeError occurred in "OffscreenFlagDisplayLayer.py": 'NoneType' object has no attribute 'getParent'
Traceback (most recent call last):
  File "python/UI4/software_python/QT4GLLayerStack/v0/LayerStack.py", line 518, in paintGL
  File "python/UI4/Tabs/NodeGraphTab/Layers/OffscreenFlagDisplayLayer.py", line 110, in paintGL
  File "python/UI4/Tabs/NodeGraphTab/Layers/OffscreenFlagDisplayLayer.py", line 132, in __drawArrowToNode
AttributeError: 'NoneType' object has no attribute 'getParent'
 
On a side note, GroupStack seems to work as expected when trying to duplicate an entry.

Expected behaviour
Duplicating a MaterialStack entry should not fail.

Actual behaviour
Duplicating a MaterialStack entry fails with an error.

    We're sorry to hear that

    Please tell us why