Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* Crash on adding contact
@ 2011-11-10  0:12 Gaute Hope
  0 siblings, 0 replies; only message in thread
From: Gaute Hope @ 2011-11-10  0:12 UTC (permalink / raw)
  To: sup-devel

[-- Attachment #1: Type: text/plain, Size: 729 bytes --]

Hi,

when adding new contacts (aliases) I get the following error (after
upgrade to ruby 1.9.3):

--- NoMethodError from thread: main
undefined method `email' for "":String
/home/gaute/dev/ruby/sup.git/lib/sup/contact.rb:34:in `update_alias'
/home/gaute/dev/ruby/sup.git/lib/sup/util.rb:572:in `method_missing'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/contact-list-mode.rb:17:in `alias_contact'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/thread-view-mode.rb:259:in `alias'
/home/gaute/dev/ruby/sup.git/lib/sup/mode.rb:59:in `handle_input'
/home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:278:in `handle_input'
bin/sup:271:in `<module:Redwood>'
bin/sup:80:in `<main>'

The attached patch seems to fix the problem.

Regards,
Gaute

[-- Attachment #2: 0001-Working-check-for-alias-on-ruby-1.9.3.patch --]
[-- Type: application/octet-stream, Size: 793 bytes --]

From 52f17a9a7d7d4ece6db05953627abc65f4145e54 Mon Sep 17 00:00:00 2001
From: Gaute Hope <eg@gaute.vetsj.com>
Date: Thu, 10 Nov 2011 01:09:22 +0100
Subject: [PATCH] Working check for alias on ruby 1.9.3

---
 lib/sup/contact.rb |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/sup/contact.rb b/lib/sup/contact.rb
index 382896d..83ab1d5 100644
--- a/lib/sup/contact.rb
+++ b/lib/sup/contact.rb
@@ -27,7 +27,8 @@ class ContactManager
   def contacts_with_aliases; @a2p.values.uniq end
 
   def update_alias person, aalias=nil
-    if(old_aalias = @p2a[person]) # remove old alias
+    old_aalias = @p2a[person]
+    if(old_aalias != nil and old_aalias != "") # remove old alias
       @a2p.delete old_aalias
       @e2p.delete old_aalias.email
     end
-- 
1.7.7.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-10  0:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-10  0:12 Crash on adding contact Gaute Hope

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox