summaryrefslogtreecommitdiff
path: root/app-text/epdfview/files/epdfview-0.1.6-print-segfault.patch
blob: 498febbd5f4855492f44c8386cc9277568ca2ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
--- src/PrintPter.cxx (revision 262)
+++ src/PrintPter.cxx (revision 281)
@@ -231,17 +231,24 @@
                 view.clearPageSizeList ();
                 int pageSizeToSelect = 0;
-                ppd_choice_t *pageSizeChoice = pageSizeOption->choices;
-                for ( int currentSize = 0 ;
-                      currentSize < pageSizeOption->num_choices ;
-                      ++currentSize, ++pageSizeChoice )
-                {
-                    const gchar *sizeName = pageSizeChoice->text;
-                    const gchar *sizeValue = pageSizeChoice->choice;
-
-                    view.addPageSize (_(sizeName), sizeValue);
-                    if ( pageSizeChoice->marked )
+                if ( 0 != pageSizeOption )
+                {
+                    ppd_choice_t *pageSizeChoice = pageSizeOption->choices;
+                    for ( int currentSize = 0 ;
+                         currentSize < pageSizeOption->num_choices ;
+                         ++currentSize, ++pageSizeChoice )
                     {
-                        pageSizeToSelect = currentSize;
+                        const gchar *sizeName = pageSizeChoice->text;
+                        const gchar *sizeValue = pageSizeChoice->choice;
+
+                        view.addPageSize (_(sizeName), sizeValue);
+                        if ( pageSizeChoice->marked )
+                        {
+                            pageSizeToSelect = currentSize;
+                        }
                     }
+                }
+                else
+                {
+                    view.addPageSize (_("A4"), "A4");
                 }
                 view.selectPageSize (pageSizeToSelect);
@@ -252,17 +259,24 @@
                 view.clearResolutionList ();
                 int resolutionToSelect = 0;
-                ppd_choice_t *resolutionChoice = resolutionOption->choices;
-                for ( int currentRes = 0 ;
-                      currentRes < resolutionOption->num_choices ;
-                      ++currentRes, ++resolutionChoice )
-                {
-                    const gchar *resName = resolutionChoice->text;
-                    const gchar *resValue = resolutionChoice->choice;
-
-                    view.addResolution (_(resName), resValue);
-                    if ( resolutionChoice->marked )
+                if ( 0 != resolutionOption )
+                {
+                    ppd_choice_t *resolutionChoice = resolutionOption->choices;
+                    for ( int currentRes = 0 ;
+                            currentRes < resolutionOption->num_choices ;
+                            ++currentRes, ++resolutionChoice )
                     {
-                        resolutionToSelect = currentRes;
+                        const gchar *resName = resolutionChoice->text;
+                        const gchar *resValue = resolutionChoice->choice;
+
+                        view.addResolution (_(resName), resValue);
+                        if ( resolutionChoice->marked )
+                        {
+                            resolutionToSelect = currentRes;
+                        }
                     }
+                }
+                else
+                {
+                    view.addResolution (_("300 DPI"), "300x300dpi");
                 }
                 view.selectResolution (resolutionToSelect);
@@ -272,7 +286,7 @@
                     ppdFindOption (printerPPD, "ColorModel");
                 view.clearColorModelList ();
+                int colorModelToSelect = 0;
                 if ( NULL != colorModelOption )
                 {
-                    int colorModelToSelect = 0;
                     ppd_choice_t *colorModelChoice = colorModelOption->choices;
                     for ( int currentColor = 0 ;
@@ -289,5 +303,4 @@
                         }
                     }
-                    view.selectColorModel (colorModelToSelect);
                 }
                 else
@@ -295,4 +308,5 @@
                     view.addColorModel (_("Grayscale"), "Gray");
                 }
+                view.selectColorModel (colorModelToSelect);
                 ppdClose (printerPPD);
             }