Browse Source

Fixes for any new platform

Unimplemented time is now a compile error
Setting up the default font will no longer dereference a null pointer
(ignored in other places)
Robert H 11 years ago
parent
commit
2372a9335d
3 changed files with 16 additions and 5 deletions
  1. 8 2
      oxygine/src/DebugActor.cpp
  2. 7 1
      oxygine/src/TextField.cpp
  3. 1 2
      oxygine/src/core/oxygine.cpp

+ 8 - 2
oxygine/src/DebugActor.cpp

@@ -98,9 +98,15 @@ namespace oxygine
 
 		setTouchEnabled(false);
 		
-
 		TextStyle st;
-		st.font = resSystem->getResFont("system")->getFont();
+		st.font = NULL;
+    
+		if (ResFont *fnt = resSystem->getResFont("system")) {
+			st.font = fnt->getFont();
+		}
+
+		OX_ASSERT(st.font != NULL);
+
 		st.vAlign = TextStyle::VALIGN_TOP;
 		//st.color = Color(rand()%255, rand()%255, rand()%255, 255);
 		st.color = Color(Color::Black, 255);

+ 7 - 1
oxygine/src/TextField.cpp

@@ -21,10 +21,16 @@ namespace oxygine
 		_textRect(0,0,0,0)
 	{
 		_flags |= flag_rebuild;
+		_style.font = NULL;
+
 		if (DebugActor::resSystem)
 		{
-			_style.font = DebugActor::resSystem->getResFont("system")->getFont();
+			if (ResFont *fnt = DebugActor::resSystem->getResFont("system")) {
+				_style.font = fnt->getFont();
+			}
 		}
+
+		OX_ASSERT(_style.font != NULL);
 	}
 
 	TextField::~TextField()

+ 1 - 2
oxygine/src/core/oxygine.cpp

@@ -159,8 +159,7 @@ namespace oxygine
 
 		return ticks;
 #else
-		log::warning("getTimeMS not implemented");
-		assert(0);
+		#pragma error "getTimeMS not implemented"
 #endif		
 		return 0;
 	}