]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/vslider.cpp
Miscellaneous improvements for handling graphics
[libs/gltk.git] / source / vslider.cpp
index a32e484906c19b0944599a47f8b0932adde24b0b..1145b97c3c762e67dfec564997baa6d6a0114e16 100644 (file)
@@ -32,6 +32,10 @@ void VSlider::rebuild_special(const Part &part, CachedPart &cache)
 {
        if(part.get_name()=="slider")
        {
+               const Graphic *graphic = part.get_graphic(state);
+               if(!graphic)
+                       return;
+
                Alignment align = part.get_alignment();
                if(max>min)
                        align.y = (value-min)/(max-min);
@@ -44,7 +48,7 @@ void VSlider::rebuild_special(const Part &part, CachedPart &cache)
 
                GL::MeshBuilder bld(*cache.mesh);
                bld.matrix() *= GL::Matrix::translation(pgeom.x, pgeom.y, 0);
-               part.get_graphic(state)->build(pgeom.w, pgeom.h, bld);
+               graphic->build(pgeom.w, pgeom.h, bld);
        }
 }