Index: generic/tk3d.c
==================================================================
--- generic/tk3d.c
+++ generic/tk3d.c
@@ -1420,18 +1420,20 @@
     Tk_3DBorder border,
     XColor *bgColorPtr,
     XColor *darkColorPtr,
     XColor *lightColorPtr)
 {
+    TkBorder *borderPtr = (TkBorder *)border;
+
     if (bgColorPtr) {
-	*bgColorPtr = *((TkBorder *)border)->bgColorPtr;
+	*bgColorPtr = *borderPtr->bgColorPtr;
     }
     if (darkColorPtr) {
-	*darkColorPtr = *((TkBorder *) border)->darkColorPtr;
+	*darkColorPtr = borderPtr->darkColorPtr ? *borderPtr->darkColorPtr : *borderPtr->bgColorPtr;
     }
     if (lightColorPtr) {
-	*lightColorPtr = *((TkBorder *) border)->lightColorPtr;
+	*lightColorPtr = borderPtr->lightColorPtr ? *borderPtr->lightColorPtr : *borderPtr->bgColorPtr;;
     }
 }
 
 /*
  * Local Variables:

