summaryrefslogtreecommitdiff
path: root/src/nsfns.m
diff options
context:
space:
mode:
authorAlan Third <alan@idiocy.org>2021-08-22 21:50:09 +0100
committerAlan Third <alan@idiocy.org>2021-12-22 20:48:19 +0000
commit42601d3a938ee5a12a557840aef11c4d3bb180f6 (patch)
treef1cf9617fafff0e7550baa7c083d197ce81b8b23 /src/nsfns.m
parent308ad05d37a2d230c65a8799e193e25f4f8ba540 (diff)
downloademacs-42601d3a938ee5a12a557840aef11c4d3bb180f6.tar.gz
emacs-42601d3a938ee5a12a557840aef11c4d3bb180f6.tar.bz2
emacs-42601d3a938ee5a12a557840aef11c4d3bb180f6.zip
Make NS toolbar use NSString instead of C strings
* src/nsfns.m ([NSString stringWithLispString:]): Ensure that the lisp object is actually a string. * src/nsmenu.m (update_frame_tool_bar): Convert to NSString instead of C strings. ([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]): No need to convert to NSString here anymore.
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 7cb2cf72581..643da01989f 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -3140,6 +3140,9 @@ all_nonzero_ascii (unsigned char *str, ptrdiff_t n)
encoded form (e.g. UTF-8). */
+ (NSString *)stringWithLispString:(Lisp_Object)string
{
+ if (!STRINGP (string))
+ return nil;
+
/* Shortcut for the common case. */
if (all_nonzero_ascii (SDATA (string), SBYTES (string)))
return [NSString stringWithCString: SSDATA (string)