qtmobility/examples/satellitedialog/main.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
--- a/qtmobility/examples/satellitedialog/main.cpp	Fri Apr 16 15:51:22 2010 +0300
+++ b/qtmobility/examples/satellitedialog/main.cpp	Mon May 03 13:18:40 2010 +0300
@@ -41,6 +41,7 @@
 
 #include <QApplication>
 #include <QMainWindow>
+#include <QMessageBox>
 #include <QTimer>
 #include <qgeopositioninfosource.h>
 #include <qgeosatelliteinfosource.h>
@@ -58,8 +59,14 @@
             SatelliteDialog::ScaleToMaxPossible);
 
     QGeoPositionInfoSource *posSource = QGeoPositionInfoSource::createDefaultSource(0);
+    QGeoSatelliteInfoSource *satSource = QGeoSatelliteInfoSource::createDefaultSource(0);
+
+    if ((posSource == 0) || (satSource == 0)) {
+        QMessageBox::critical(0, "SatelliteDialog", "This examples requires a valid location source and no valid location sources are available on this platform.");
+        return -1;
+    }
+
     posSource->setUpdateInterval(5000);
-    QGeoSatelliteInfoSource *satSource = QGeoSatelliteInfoSource::createDefaultSource(0);
 
     dialog->connectSources(posSource, satSource);