diff --git a/example/main.cpp b/example/main.cpp
index e57f241cf5cf7ee602f1e0ba238b0da6205fdc1e..e38c80a3379888a3f73c0e77b52fb439408fccab 100644
--- a/example/main.cpp
+++ b/example/main.cpp
@@ -824,7 +824,7 @@ int main (int argc, char * const argv[]) {
     device_id = NULL;
     unsigned int i = 0;
 
-    if (argc == 3) {
+    if (argc >= 3) {
         cl_bool available;
         err = clGetDeviceInfo(device_ids[atoi(argv[2])], CL_DEVICE_AVAILABLE, sizeof(cl_bool), &available, NULL);
         if(err) {