Merge pull request #1557 from acrisci/bug/fix-validation-segfault

Bugfix: validation segfault
This commit is contained in:
Michael Stapelberg 2015-03-22 14:32:36 +01:00
commit 0b65ea5b62
1 changed files with 6 additions and 0 deletions

View File

@ -17,6 +17,12 @@ extern xcb_screen_t *root_screen;
* *
*/ */
int logical_px(const int logical) { int logical_px(const int logical) {
if (root_screen == NULL) {
/* Dpi info may not be available when parsing a config without an X
* server, such as for config file validation. */
return logical;
}
const int dpi = (double)root_screen->height_in_pixels * 25.4 / const int dpi = (double)root_screen->height_in_pixels * 25.4 /
(double)root_screen->height_in_millimeters; (double)root_screen->height_in_millimeters;
/* There are many misconfigurations out there, i.e. systems with screens /* There are many misconfigurations out there, i.e. systems with screens