From 9c5c7e6292e8ef16e43e8a3cc41c5764338731aa Mon Sep 17 00:00:00 2001
From: Themaister <maister@archlinux.us>
Date: Sun, 6 Oct 2013 16:51:50 +0200
Subject: [PATCH] Fix broken save_keybind_hat.

---
 settings.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/settings.c b/settings.c
index 1cdbb42f29..56a037da91 100644
--- a/settings.c
+++ b/settings.c
@@ -945,7 +945,7 @@ static void save_keybind_hat(config_file_t *conf, const char *key, const struct
    unsigned hat = GET_HAT(bind->joykey);
    const char *dir = NULL;
 
-   switch (GET_HAT_DIR(hat))
+   switch (GET_HAT_DIR(bind->joykey))
    {
       case HAT_UP_MASK:
          dir = "up";
@@ -964,6 +964,7 @@ static void save_keybind_hat(config_file_t *conf, const char *key, const struct
          break;
 
       default:
+         RARCH_ERR("Hat direction is invalid: 0x%x.\n", (unsigned)GET_HAT_DIR(hat));
          rarch_assert(0);
    }