Fixe a bug in platform detection

If there was a device with no gpu before a device with gpus the program would exit prematurly.
Merge branch 'platform-detection-fix'