- if (r)
- *r = SP->_color_table[color].red;
- if (g)
- *g = SP->_color_table[color].green;
- if (b)
- *b = SP->_color_table[color].blue;
- T(("...color_content(%d,%d,%d,%d)", color, *r, *g, *b));
- returnCode(OK);
+ T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b));
+ if (color < 0 || color >= COLORS || SP == 0 || !SP->_coloron) {
+ result = ERR;
+ } else {
+ NCURSES_COLOR_T c_r = SP->_color_table[color].red;
+ NCURSES_COLOR_T c_g = SP->_color_table[color].green;
+ NCURSES_COLOR_T c_b = SP->_color_table[color].blue;
+
+ if (r)
+ *r = c_r;
+ if (g)
+ *g = c_g;
+ if (b)
+ *b = c_b;
+
+ T(("...color_content(%d,%d,%d,%d)", color, c_r, c_g, c_b));
+ result = OK;
+ }
+ returnCode(result);