The "xc" tree merged with VNC 4.1.1 code.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/branches/merge-with-vnc-4.1.1@526 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/xc/programs/Xserver/vnc/RegionHelper.h b/xc/programs/Xserver/vnc/RegionHelper.h
index 786622d..61dc89f 100644
--- a/xc/programs/Xserver/vnc/RegionHelper.h
+++ b/xc/programs/Xserver/vnc/RegionHelper.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -22,6 +22,13 @@
 // automatically freeing them in the destructor.  It also fixes a problem with
 // REGION_INIT when given an empty rectangle.
 
+// REGION_NULL was introduced in the Xorg tree as the way to initialise an
+// empty region.  If it's not already defined do it the old way.  Note that the
+// old way causes a segfault in the new tree...
+#ifndef REGION_NULL
+#define REGION_NULL(pScreen,pReg) REGION_INIT(pScreen,pReg,NullBox,0)
+#endif
+
 class RegionHelper {
 public:
 
@@ -54,7 +61,7 @@
 
   void init(BoxPtr rect, int size) {
     reg = &regRec;
-    if (!rect || (rect->x2 == rect->x1 || rect->y2 == rect->y1)) {
+    if (!rect || (rect && (rect->x2 == rect->x1 || rect->y2 == rect->y1))) {
       REGION_NULL(pScreen, reg);
     } else {
       REGION_INIT(pScreen, reg, rect, size);