]> code.delx.au - refind/blobdiff - libeg/text.c
Refinement to hint function for greater context sensitivity.
[refind] / libeg / text.c
index a59e8cb2287d1f5e09332d8b91b65ea22dd295fd..93551b2b082558d615166eb3b392cfa2a83d2e50 100644 (file)
@@ -35,6 +35,7 @@
  */
 
 #include "libegint.h"
+//#include "../refind/screen.h"
 
 #include "egemb_font.h"
 #define FONT_CELL_WIDTH (7)
@@ -61,16 +62,20 @@ VOID egRenderText(IN CHAR16 *Text, IN OUT EG_IMAGE *CompImage, IN UINTN PosX, IN
     UINTN           BufferLineOffset, FontLineOffset;
     UINTN           TextLength;
     UINTN           i, c;
-    
+
     // clip the text
-    TextLength = StrLen(Text);
+    if (Text)
+       TextLength = StrLen(Text);
+    else
+       TextLength = 0;
+
     if (TextLength * FONT_CELL_WIDTH + PosX > CompImage->Width)
         TextLength = (CompImage->Width - PosX) / FONT_CELL_WIDTH;
 
     // load the font
     if (FontImage == NULL)
         FontImage = egPrepareEmbeddedImage(&egemb_font, TRUE);
-    
+
     // render it
     BufferPtr = CompImage->PixelData;
     BufferLineOffset = CompImage->Width;