Check if there is a current icon item in the device manager. Fixes #4604 #4555 

When we open the device properties dialog for the first time there is no selected icon so this segfault when we just click on OK. I just added a condition to be sure that *icon->currentItem* is not *null*.

(#4604 was a duplicate of #4555).
I prefer "if(ptr)" syntax over "if(ptr != null)" and I believe this is the convention we have almost everywhere else