aboutsummaryrefslogtreecommitdiffstats
path: root/widget_text.c
diff options
context:
space:
mode:
authorvolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2013-02-13 13:49:22 +0000
committervolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2013-02-13 13:49:22 +0000
commit5559e7f6cb8e9e5bdc54677704db5abcf84306ee (patch)
tree8f807dee1ad631fe530d52f44c7961a71f5c82a8 /widget_text.c
parent71df54522bbf46cbc18666be702106d1d591912a (diff)
downloadlcd4linux-5559e7f6cb8e9e5bdc54677704db5abcf84306ee.tar.gz
stabilize text widget when no string is available; info message when serdisplib cannot open port
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1192 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'widget_text.c')
-rw-r--r--widget_text.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/widget_text.c b/widget_text.c
index 7c1ee7a..ee178e6 100644
--- a/widget_text.c
+++ b/widget_text.c
@@ -58,6 +58,10 @@
void widget_text_scroll(void *Self)
{
WIDGET *W = (WIDGET *) Self;
+ if (NULL == W || NULL == W->data) {
+ error("Warning: internal data error in Textwidget");
+ return;
+ }
WIDGET_TEXT *T = W->data;
char *prefix = P2S(&T->prefix);
@@ -68,6 +72,10 @@ void widget_text_scroll(void *Self)
int num, len, width, pad;
char *src, *dst;
+ if (NULL == string) {
+ error("Warning: Widget %s has no string", W->name);
+ return;
+ }
num = 0;
len = strlen(string);
width = T->width - strlen(prefix) - strlen(postfix);