[gnumeric] fix gnm_sheet_get_max_* (NULL)
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] fix gnm_sheet_get_max_* (NULL)
- Date: Sun, 7 Jun 2009 13:55:27 -0400 (EDT)
commit a4c0def5da26dbbac6eab53d794ea1b3825a88df
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Sun Jun 7 11:54:51 2009 -0600
fix gnm_sheet_get_max_* (NULL)
2009-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
* dao.c (dao_adjust): avoid calling gnm_sheet_get_max_* with
NULL sheet.
---
src/tools/ChangeLog | 5 +++++
src/tools/dao.c | 15 +++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index f3f5e82..6e0e80d 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -1,5 +1,10 @@
2009-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * dao.c (dao_adjust): avoid calling gnm_sheet_get_max_* with
+ NULL sheet.
+
+2009-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* analysis-chi-squared.[ch]: new
* Makefile.am: added the above
diff --git a/src/tools/dao.c b/src/tools/dao.c
index 81f99f1..57d4efd 100644
--- a/src/tools/dao.c
+++ b/src/tools/dao.c
@@ -198,8 +198,7 @@ dao_command_descriptor (data_analysis_output_t *dao, char const *format,
void
dao_adjust (data_analysis_output_t *dao, gint cols, gint rows)
{
- int max_rows = gnm_sheet_get_max_rows (dao->sheet) - dao->start_row;
- int max_cols = gnm_sheet_get_max_cols (dao->sheet) - dao->start_col;
+ int max_rows, max_cols;
if (dao->cols == 1 && dao->rows == 1) {
if (cols != -1)
@@ -213,6 +212,18 @@ dao_adjust (data_analysis_output_t *dao, gint cols, gint rows)
dao->rows = MIN (rows, dao->rows);
}
+ if (dao->sheet) {
+ max_rows = gnm_sheet_get_max_rows (dao->sheet) - dao->start_row;
+ max_cols = gnm_sheet_get_max_cols (dao->sheet) - dao->start_col;
+ } else {
+ /* In case of NewSheetOutput and NewWorkbookOutput */
+ /* this is called before we actually create the */
+ /* new sheet and/or workbook */
+ Sheet *old_sheet = wb_control_cur_sheet (dao->wbc);
+ max_rows = gnm_sheet_get_max_rows (old_sheet) - dao->start_row;
+ max_cols = gnm_sheet_get_max_cols (old_sheet) - dao->start_col;
+ }
+
if (dao->cols > max_cols)
dao->cols = max_cols;
if (dao->rows > max_rows)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]