]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/hslider.cpp
Miscellaneous improvements for handling graphics
[libs/gltk.git] / source / hslider.cpp
index fbd9b943a8c4703dc8fe77acc542df843777173f..2a3644367ea52adb85beeb1f2f02abad007fc25c 100644 (file)
@@ -32,6 +32,10 @@ void HSlider::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.x = (value-min)/(max-min);
@@ -44,7 +48,7 @@ void HSlider::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);
        }
 }