Branch: refs/heads/master Author: Frank Lanitz frank@frank.uvena.de Committer: Frank Lanitz frank@frank.uvena.de Date: Mon, 20 Feb 2017 08:40:04 UTC Commit: 2a3ff8cf630499e7a94c6bec7a6739a96b0ca37d https://github.com/geany/geany-plugins/commit/2a3ff8cf630499e7a94c6bec7a6739...
Log Message: ----------- Add a additional checks for doc != NULL and removing such ones later to ensure there is no access of doc before it has been checked against NULL.
Modified Paths: -------------- lineoperations/src/lineoperations.c
Modified: lineoperations/src/lineoperations.c 14 lines changed, 7 insertions(+), 7 deletions(-) =================================================================== @@ -160,6 +160,8 @@ action_indir_manip_item(GtkMenuItem *menuitem, gpointer gdata) gint (*func)(gchar **lines, gint num_lines, gchar *new_file) = gdata; GeanyDocument *doc = document_get_current();
+ g_return_if_fail(doc != NULL); + struct lo_lines sel = get_current_sel_lines(doc->editor->sci); gint num_lines = (sel.end_line - sel.start_line) + 1;
@@ -191,10 +193,7 @@ action_indir_manip_item(GtkMenuItem *menuitem, gpointer gdata)
sci_start_undo_action(doc->editor->sci);
- - if(doc) - lines_affected = func(lines, num_lines, new_file); - + lines_affected = func(lines, num_lines, new_file);
/* set new document */ sci_replace_sel(doc->editor->sci, new_file); @@ -223,14 +222,15 @@ action_sci_manip_item(GtkMenuItem *menuitem, gpointer gdata) /* function pointer to gdata -- function to be used */ gint (*func)(ScintillaObject *, gint, gint) = gdata; GeanyDocument *doc = document_get_current(); + + g_return_if_fail(doc != NULL); + struct lo_lines sel = get_current_sel_lines(doc->editor->sci); gint lines_affected = 0;
- sci_start_undo_action(doc->editor->sci);
- if(doc) - lines_affected = func(doc->editor->sci, sel.start_line, sel.end_line); + lines_affected = func(doc->editor->sci, sel.start_line, sel.end_line);
/* put message in ui_statusbar, and highlight lines that were affected */ user_indicate(doc->editor, lines_affected, sel);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).