Просмотр исходного кода

* Only remove key if it exists

Bryan Drewery 14 лет назад
Родитель
Сommit
492cdb5254
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      src/chanprog.c

+ 5 - 4
src/chanprog.c

@@ -949,12 +949,13 @@ void keyx(const bd::String &target) {
 
 void set_fish_key(char *target, char *key)
 {
-  fish_data_t* fishData = NULL;
-  fishData = FishKeys[target];
+  fish_data_t* fishData = FishKeys.contains(target) ? FishKeys[target] : NULL;
 
   if (!key || !key[0]) { //remove key
-    FishKeys.remove(target);
-    delete fishData;
+    if (fishData) {
+      FishKeys.remove(target);
+      delete fishData;
+    }
   } else { //set key
     fishData = new fish_data_t;