- // on error (when trying to use empty surface), give up
- } catch (const std::runtime_error& err) {
- throw err;
- }
+ // on error, try loading placeholder file
+ try
+ {
+ TexturePtr tex = create_image_texture_raw(dummy_texture_fname);
+ return tex;
+ }
+ catch (const std::exception& err)
+ {
+ // on error (when loading placeholder), try using empty surface,
+ // when that fails to, just give up
+ SDLSurfacePtr image(SDL_CreateRGBSurface(0, 1024, 1024, 8, 0, 0, 0, 0));
+ if (!image)
+ {
+ throw;
+ }
+ else
+ {
+ log_warning << "Couldn't load texture '" << dummy_texture_fname << "' (now using empty one): " << err.what() << std::endl;
+ TexturePtr texture = VideoSystem::current()->new_texture(image.get());
+ image.reset(NULL);
+ return texture;