openbsd-ports/net/amule/patches/patch-src_Statistics_cpp
dcoppa dc814c74e9 Fix a couple of crashers:
fix crash on truncated statistics.dat
(upstream git commit 5e3682f7efed13eb52e4358a2d91b0e381334120)

fix amuleweb crash on CProgressImage::CreateSpan
(upstream git commit 846dcf92ce64fd42caf8a86d644fe3a3f4683d09)

And:

fix showing of shared files to other clients
(upstream git commit 4e40aecb160baac72aa28a8a4c7aaf19261e051f)

change nodes.dat default download URL to something actually working
(upstream git commit 8dbe597539bcac7272ccf4d46790fde814aeded1)
2012-02-22 07:54:26 +00:00

38 lines
1.0 KiB
Plaintext

$OpenBSD: patch-src_Statistics_cpp,v 1.1 2012/02/22 07:54:26 dcoppa Exp $
Fix crash on truncated statistics.dat
(upstream git commit 5e3682f7efed13eb52e4358a2d91b0e381334120)
--- src/Statistics.cpp.orig Mon Jun 13 10:50:25 2011
+++ src/Statistics.cpp Tue Feb 21 17:15:40 2012
@@ -25,6 +25,7 @@
//
#include "Statistics.h" // Interface declarations
+#include "Logger.h"
#include <protocol/ed2k/ClientSoftware.h>
@@ -311,12 +312,16 @@ void CStatistics::Load()
s_totalSent = 0;
s_totalReceived = 0;
- if (f.Open(JoinPaths(theApp->ConfigDir, wxT("statistics.dat")))) {
- uint8_t version = f.ReadUInt8();
- if (version == 0) {
- s_totalSent = f.ReadUInt64();
- s_totalReceived = f.ReadUInt64();
+ try {
+ if (f.Open(JoinPaths(theApp->ConfigDir, wxT("statistics.dat")))) {
+ uint8_t version = f.ReadUInt8();
+ if (version == 0) {
+ s_totalSent = f.ReadUInt64();
+ s_totalReceived = f.ReadUInt64();
+ }
}
+ } catch (CSafeIOException e) {
+ AddLogLineN(e.what());
}
// Load old values from config