diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
index 2825482..7e8c518 100644
--- a/plugins/mouse/gsd-mouse-manager.c
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -1018,6 +1018,10 @@ set_scroll_wheel_button (GsdMouseManager *manager,
         int button;
         int rc;
 
+        button = g_settings_get_int (manager->priv->trackball_settings, KEY_SCROLL_WHEEL_BUTTON);
+        if (!button)
+                return;
+
         if (!device_is_trackball (device))
                 return;
 
@@ -1042,8 +1046,6 @@ set_scroll_wheel_button (GsdMouseManager *manager,
 
         gdk_error_trap_push ();
 
-        button = g_settings_get_int (manager->priv->trackball_settings, KEY_SCROLL_WHEEL_BUTTON);
-
         /* Whether scroll wheel emulation is enabled */
         rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
                                  xdevice, wheel_prop, 0, 1, False, XA_INTEGER, &type, &format,
