浏览代码

don't crash if window not opened

David Rose 22 年之前
父节点
当前提交
3e8f0ebac2
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      direct/src/showbase/ShowBase.py

+ 3 - 2
direct/src/showbase/ShowBase.py

@@ -988,8 +988,9 @@ class ShowBase(DirectObject.DirectObject):
             color = VBase4(arg[0], arg[1], arg[2], 1.0)
         else:
             raise TypeError, ('Invalid number of arguments: %d, expected 1, 3, or 4.' % numArgs)
-            
-        self.win.setClearColor(color)
+
+        if self.win:
+            self.win.setClearColor(color)
                 
     def toggleBackface(self):
         if self.backfaceCullingEnabled: