Author: matt
Date: 2010-12-06 15:23:44 -0800 (Mon, 06 Dec 2010)
New Revision: 7967
Log:
Fixed case when reading empty file
Modified:
branches/branch-1.3/src/Fl_Text_Buffer.cxx
Modified: branches/branch-1.3/src/Fl_Text_Buffer.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Text_Buffer.cxx 2010-12-06 18:44:33 UTC (rev
7966)
+++ branches/branch-1.3/src/Fl_Text_Buffer.cxx 2010-12-06 23:23:44 UTC (rev
7967)
@@ -1526,6 +1526,7 @@
fseek(fp, 0, SEEK_END);
size_t filesize = ftell(fp);
fseek(fp, 0, SEEK_SET);
+ if (!filesize) return 0;
char *buffer = new char[filesize+1];
if (fread(buffer, 1, filesize, fp)==filesize) {
buffer[filesize] = (char) 0;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit