pidgin/pidgincolor.c

changeset 41286
a0f2d660128d
parent 40951
c83bf354d142
child 41519
4dcf742979d3
equal deleted inserted replaced
41285:cc3c735c14f4 41286:a0f2d660128d
39 39
40 pidgin_style_context_get_background_color(&background); 40 pidgin_style_context_get_background_color(&background);
41 41
42 /* hash the string and get the first 2 bytes of the digest */ 42 /* hash the string and get the first 2 bytes of the digest */
43 checksum = g_checksum_new(G_CHECKSUM_SHA1); 43 checksum = g_checksum_new(G_CHECKSUM_SHA1);
44 g_checksum_update(checksum, (const guchar *)text, -1); 44 if(text != NULL) {
45 g_checksum_update(checksum, (const guchar *)text, -1);
46 }
45 g_checksum_get_digest(checksum, digest, &digest_len); 47 g_checksum_get_digest(checksum, digest, &digest_len);
46 g_checksum_free(checksum); 48 g_checksum_free(checksum);
47 49
48 /* Calculate the hue based on the digest. We need a value between 0 and 1 50 /* Calculate the hue based on the digest. We need a value between 0 and 1
49 * so we divide the value by 65535 which is the maximum value for 2 bytes. 51 * so we divide the value by 65535 which is the maximum value for 2 bytes.

mercurial