Fix #1877 when reloading macro with same name as macro library
This MR fixes #1877 (closed) .
It avoids the following error message to be thrown on spock
terminal when macro library and macro have the same name. It can be quite confusing for the user, because the macro is still reloaded even with the error message.
Door_demo1_1 [10]: TaurusTP.W003 ERROR 2023-07-24 09:25:07,147 pt222.cells.es:10000.MS_demo1_1: Details:
Traceback (most recent call last):
File "/homelocal/zreszela/workspace/sardana/src/sardana/taurus/core/tango/sardana/macroserver.py", line 979, in on_elements_changed
return self._on_elements_changed(evt_src, evt_type, evt_value)
File "/homelocal/zreszela/workspace/sardana/src/sardana/taurus/core/tango/sardana/macroserver.py", line 1016, in _on_elements_changed
element = self._removeElement(element_data)
File "/homelocal/zreszela/workspace/sardana/src/sardana/spock/spockms.py", line 668, in _removeElement
element = BaseMacroServer._removeElement(self, element_data)
File "/homelocal/zreszela/workspace/sardana/src/sardana/taurus/core/tango/sardana/macroserver.py", line 1030, in _removeElement
self.getElementsInfo().removeElement(element)
File "/homelocal/zreszela/workspace/sardana/src/sardana/taurus/core/tango/sardana/sardana.py", line 165, in removeElement
elem_type = e.getType()
AttributeError: 'NoneType' object has no attribute 'getType'