Default to launching MicroB if default_browser is unset
[browser-switch] / dbus-server-bindings.c
index 3c7718e..939056b 100644 (file)
@@ -47,7 +47,14 @@ static void open_address(const char *uri) {
        char *new_uri;
        size_t new_uri_len;
 
-       if (!uri && uri[0] == '/') {
+       if (!uri)
+               /* Not much to do in this case ... */
+               return;
+
+       printf("open_address '%s'\n", uri);
+       if (uri[0] == '/') {
+               /* URI begins with a '/' -- assume it points to a local file
+                  and prefix with "file://" */
                new_uri_len = strlen("file://") + strlen(uri) + 1;
                if (!(new_uri = calloc(new_uri_len, sizeof(char))))
                        exit(1);
@@ -58,7 +65,6 @@ static void open_address(const char *uri) {
                   we need to clean up after ourselves */
                free(new_uri);
        } else {
-               printf("open_address '%s'\n", uri);
                launch_browser(&ctx, (char *)uri);
        }
 }