Fall back to default when rendering mode (3d_mode) is set invalid (#10922)

This commit is contained in:
Muhammad Rifqi Priyo Susanto 2021-02-06 19:47:12 +07:00 committed by GitHub
parent fbb9ef3818
commit 3ac07ad34d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/ */
#include "factory.h" #include "factory.h"
#include <stdexcept> #include "log.h"
#include "plain.h" #include "plain.h"
#include "anaglyph.h" #include "anaglyph.h"
#include "interlaced.h" #include "interlaced.h"
@ -45,5 +45,8 @@ RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevic
return new RenderingCoreSideBySide(device, client, hud, true); return new RenderingCoreSideBySide(device, client, hud, true);
if (stereo_mode == "crossview") if (stereo_mode == "crossview")
return new RenderingCoreSideBySide(device, client, hud, false, true); return new RenderingCoreSideBySide(device, client, hud, false, true);
throw std::invalid_argument("Invalid rendering mode: " + stereo_mode);
// fallback to plain renderer
errorstream << "Invalid rendering mode: " << stereo_mode << std::endl;
return new RenderingCorePlain(device, client, hud);
} }