[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kopete-devel
Subject:    [Kopete-devel] [PATCH] crash with empty history
From:       Andy Goossens <andygoossens () pandora ! be>
Date:       2002-05-10 13:37:52
[Download RAW message or body]

Hi all,

Viewing an empty history crashes Kopete.

I traced it back to kopetehistorywidget.cpp:

        FILE *f = fopen(logFileName, "r");

        if (f == NULL)
        {
                // Oops, no file
                messages = 0;
        }
        else
        {
                messages = countMessages();
        }

        fclose( f ); // <-- Crashes when f == NULL

Patch attached :-)

-- 
Andy Goossens -- andygoossens at softhome dot net

"Use the Source, Luke..."
["history.patch" (text/x-diff)]

Index: kopetehistorywidget.cpp
===================================================================
RCS file: /home/kdecvs/kde/kdenonbeta/kopete/libkopete/ui/kopetehistorywidget.cpp,v
retrieving revision 1.2
diff -u -3 -p -r1.2 kopetehistorywidget.cpp
--- kopetehistorywidget.cpp	4 May 2002 14:40:21 -0000	1.2
+++ kopetehistorywidget.cpp	10 May 2002 13:22:43 -0000
@@ -160,9 +160,8 @@ void KopeteHistoryWidget::init()
 	else
 	{
 		messages = countMessages();
+		fclose( f );
 	}
-
-	fclose( f );
 
 	if ( messages == 0 )
 	{

_______________________________________________
Kopete-devel mailing list
Kopete-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kopete-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic