[gnumeric] Compilation: check index before use.



commit cea3cc9fa91f5ea21cec0dcda3091d6fe22d5d93
Author: Morten Welinder <terra gnome org>
Date:   Sun Nov 19 21:11:02 2017 -0500

    Compilation: check index before use.
    
    Code probably isn't wrong, but checking first seems right

 src/dialogs/dialog-autoformat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/dialogs/dialog-autoformat.c b/src/dialogs/dialog-autoformat.c
index ec946ed..4d73616 100644
--- a/src/dialogs/dialog-autoformat.c
+++ b/src/dialogs/dialog-autoformat.c
@@ -390,7 +390,7 @@ cb_canvas_button_press (GocCanvas *canvas,
        GSList *ptr;
        int index = 0;
 
-       while (canvas != state->canvas[index] && index < NUM_PREVIEWS)
+       while (index < NUM_PREVIEWS && canvas != state->canvas[index])
                index++;
 
        g_return_val_if_fail (index < NUM_PREVIEWS, FALSE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]