summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wong <markwkm@gmail.com>2007-09-24 23:33:18 -0700
committerMark Wong <markwkm@gmail.com>2007-09-24 23:33:18 -0700
commit09ef9913931fd81e443bc0083be0a937d61d58ad (patch)
treedf302c643b07aa0fc401f7765d9b562cfe183b72
parentfe9f774dd55c1cbeebebb9a75992639d9739899f (diff)
Re-commited changes so that ptop doesn't seg fault if the databasev3.6.1-pre5
server is not up.
-rw-r--r--display.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/display.c b/display.c
index 3c086fc..0493705 100644
--- a/display.c
+++ b/display.c
@@ -327,7 +327,7 @@ display_write(int x, int y, int newcolor, int eol, char *new)
colorp = &colorbuf[lineindex(y) + x];
/* main loop */
- while ((ch = *new++) != '\0')
+ while (new != NULL && (ch = *new++) != '\0')
{
/* if either character or color are different, an update is needed */
/* but only when the screen is wide enough */
@@ -511,7 +511,7 @@ summary_format(int x, int y, int *numbers, char **names)
/* if the last string has a separator on the end, it has to be
written with care */
- if ((num = strlen(lastname)) > 1 &&
+ if (lastname != NULL && (num = strlen(lastname)) > 1 &&
lastname[num-2] == ',' && lastname[num-1] == ' ')
{
display_fmt(-1, -1, 0, 1, "%.*s", num-2, lastname);