After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 378558 - Crash on opening empty text file (Fix attached)
Crash on opening empty text file (Fix attached)
Status: RESOLVED DUPLICATE of bug 345477
Product: Gnumeric
Classification: Applications
Component: General
1.7.x
Other Linux
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2006-11-23 18:05 UTC by ville
Modified: 2006-11-24 01:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
one-liner for fixing this (785 bytes, patch)
2006-11-23 18:09 UTC, ville
none Details | Review

Description ville 2006-11-23 18:05:19 UTC
This bug is forwarded from ubuntu bug tracking system:
https://launchpad.net/distros/ubuntu/+source/gnumeric/+bug/72966

Original description:
"I launched Gnumeric accidentally by double clicking on a file called "industries.csv" which is 1 byte long (a newline character, 0x0a).

For what it's worth, Gnumeric also crashes when opening (double click in nautilus, use gnome-open, or launch Gnumeric first and choose file->open from the menu) an empty file called "empty.csv" but succeeds on similarly named 1 byte files containing a comma (0x2c) or tab character (0x09).

Bug Buddy reports the following error, so I'll just paste the traceback details below..."


I fount that giving null to strchr function caused these problems and here's
a little one-liner for fixing this.

--- src/stf-parse.c.orig	2006-11-23 19:58:39.000000000 +0200
+++ src/stf-parse.c	2006-11-23 20:01:02.000000000 +0200
@@ -1418,10 +1418,12 @@
 		stf_parse_options_set_type (res, PARSE_TYPE_CSV);
 		stf_parse_options_set_trim_spaces (res, TRIM_TYPE_LEFT | TRIM_TYPE_RIGHT);
 		stf_parse_options_csv_set_indicator_2x_is_single (res, TRUE);
-		stf_parse_options_csv_set_duplicates
-			(res, strchr (res->sep.chr, ' ') != NULL);
-		stf_parse_options_csv_set_trim_seps
-			(res, strchr (res->sep.chr, ' ') != NULL);
+		if (res->sep.chr) {
+			stf_parse_options_csv_set_duplicates
+				(res, strchr (res->sep.chr, ' ') != NULL);
+			stf_parse_options_csv_set_trim_seps
+				(res, strchr (res->sep.chr, ' ') != NULL);
+		}
 
 		stf_parse_options_csv_set_stringindicator (res, '"');
 	} else {
Comment 1 ville 2006-11-23 18:09:46 UTC
Created attachment 77069 [details] [review]
one-liner for fixing this
Comment 2 Morten Welinder 2006-11-24 01:45:01 UTC

*** This bug has been marked as a duplicate of 345477 ***