WinRT: fixed a crash in some display orientation hint code

This commit is contained in:
David Ludwig 2013-08-13 20:28:48 -04:00
parent 3dde6e1e9f
commit 45ef345df0

View File

@ -10,6 +10,7 @@ extern "C" {
#include "SDL_events.h" #include "SDL_events.h"
#include "SDL_hints.h" #include "SDL_hints.h"
#include "SDL_log.h" #include "SDL_log.h"
#include "SDL_main.h"
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "SDL_render.h" #include "SDL_render.h"
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
@ -93,6 +94,7 @@ static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *n
// Start with no orientation flags, then add each in as they're parsed // Start with no orientation flags, then add each in as they're parsed
// from newValue. // from newValue.
unsigned int orientationFlags = 0; unsigned int orientationFlags = 0;
if (newValue) {
std::istringstream tokenizer(newValue); std::istringstream tokenizer(newValue);
while (!tokenizer.eof()) { while (!tokenizer.eof()) {
std::string orientationName; std::string orientationName;
@ -107,6 +109,7 @@ static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *n
orientationFlags |= (unsigned int) DisplayOrientations::PortraitFlipped; orientationFlags |= (unsigned int) DisplayOrientations::PortraitFlipped;
} }
} }
}
// If no valid orientation flags were specified, use a reasonable set of defaults: // If no valid orientation flags were specified, use a reasonable set of defaults:
if (!orientationFlags) { if (!orientationFlags) {
@ -245,6 +248,7 @@ void SDL_WinRTApp::Load(Platform::String^ entryPoint)
void SDL_WinRTApp::Run() void SDL_WinRTApp::Run()
{ {
SDL_SetMainReady();
if (SDL_WinRT_main) if (SDL_WinRT_main)
{ {
// TODO, WinRT: pass the C-style main() a reasonably realistic // TODO, WinRT: pass the C-style main() a reasonably realistic