2009-08-11 Benjamin Otte <otte@gnome.org>
authorxan@webkit.org <xan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Aug 2009 18:29:20 +0000 (18:29 +0000)
committerxan@webkit.org <xan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Aug 2009 18:29:20 +0000 (18:29 +0000)
        Reviewed by Xan Lopez.

        When instructed to print an out-of-range page, print an empty page
        instead of crashing.

        * webkit/webkitwebframe.cpp:
        (draw_page_callback):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@47041 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/gtk/ChangeLog
WebKit/gtk/webkit/webkitwebframe.cpp

index 4d49861..0a61be9 100644 (file)
@@ -1,3 +1,13 @@
+2009-08-11  Benjamin Otte  <otte@gnome.org>
+
+        Reviewed by Xan Lopez.
+
+        When instructed to print an out-of-range page, print an empty page
+        instead of crashing.
+
+        * webkit/webkitwebframe.cpp:
+        (draw_page_callback):
+
 2009-08-10  Brady Eidson  <beidson@apple.com>
 
         GTK build fix.
index fba084e..7e2ce45 100644 (file)
@@ -696,6 +696,9 @@ static void draw_page_callback(GtkPrintOperation* op, GtkPrintContext* context,
 {
     PrintContext* printContext = reinterpret_cast<PrintContext*>(user_data);
 
+    if (page_nr >= printContext->pageCount())
+        return;
+
     cairo_t* cr = gtk_print_context_get_cairo_context(context);
     GraphicsContext ctx(cr);
     float width = gtk_print_context_get_width(context);