]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xrc/xh_animatctrl.cpp
Ensure there is valid context for DrawRectangle
[wxWidgets.git] / src / xrc / xh_animatctrl.cpp
index 6bded88fdca7730daf4f48269a9fccd80221dffb..b912f1b92bbbd4ddd9fbf03f2df0277c5439e758 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "wx/xrc/xh_animatctrl.h"
 #include "wx/animate.h"
+#include "wx/scopedptr.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler, wxXmlResourceHandler)
 
@@ -33,9 +34,11 @@ wxObject *wxAnimationCtrlXmlHandler::DoCreateResource()
 {
     XRC_MAKE_INSTANCE(ctrl, wxAnimationCtrl)
 
+    wxScopedPtr<wxAnimation> animation(GetAnimation(wxT("animation")));
+
     ctrl->Create(m_parentAsWindow,
                   GetID(),
-                  GetAnimation(wxT("animation")),
+                  animation ? *animation : wxNullAnimation,
                   GetPosition(), GetSize(),
                   GetStyle(wxT("style"), wxAC_DEFAULT_STYLE),
                   GetName());