[med-svn] [filo] 01/04: Avoid a segfault when given no records
Kevin Murray
daube-guest at moszumanska.debian.org
Mon Dec 21 14:03:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
daube-guest pushed a commit to branch master
in repository filo.
commit 49a70373916e76633505d755ebe59749efe5c179
Author: Kevin Murray <spam at kdmurray.id.au>
Date: Tue Dec 22 00:46:12 2015 +1100
Avoid a segfault when given no records
---
...01-Avoid-a-segfault-when-given-no-records.patch | 24 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 25 insertions(+)
diff --git a/debian/patches/0001-Avoid-a-segfault-when-given-no-records.patch b/debian/patches/0001-Avoid-a-segfault-when-given-no-records.patch
new file mode 100644
index 0000000..3778b32
--- /dev/null
+++ b/debian/patches/0001-Avoid-a-segfault-when-given-no-records.patch
@@ -0,0 +1,24 @@
+From: Kevin Murray <spam at kdmurray.id.au>
+Date: Tue, 22 Dec 2015 00:45:19 +1100
+Subject: Avoid a segfault when given no records
+
+---
+ src/stats/stats.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/stats/stats.cpp b/src/stats/stats.cpp
+index c394816..733d9bc 100755
+--- a/src/stats/stats.cpp
++++ b/src/stats/stats.cpp
+@@ -205,6 +205,11 @@ int main(int argc, char* argv[]) {
+ cout << "Total lines:\t\t" << setprecision (15) << totalLines << endl;
+ cout << "Sum of lines:\t\t" << setprecision (15) << sumOfLines << endl;
+
++ // Abandon further calculation if there are no records.
++ if (totalLines < 1) {
++ return 0;
++ }
++
+ if (doMean || doAll) {
+ // compute the mean
+ mean = sumOfLines / totalLines;
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..b0a3a8d
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Avoid-a-segfault-when-given-no-records.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/filo.git
More information about the debian-med-commit
mailing list