This is my second attempt on fixing issue #3635. It turns out that the error is caused by dropping image onto an empty artboard, which triggers layer replacement. Although the new layer is replaced by an existing layer, PS still emitting message with the incorrect ID of the replaced layer, and that's why the layers.addLayers failed. This PR checks if the id from event.layerID exists before adding a new layer.
This is my second attempt on fixing issue #3635. It turns out that the error is caused by dropping image onto an empty artboard, which triggers layer replacement. Although the new layer is replaced by an existing layer, PS still emitting message with the incorrect ID of the replaced layer, and that's why the
layers.addLayers
failed. This PR checks if the id fromevent.layerID
exists before adding a new layer.