Revision: 42140
http://brlcad.svn.sourceforge.net/brlcad/?rev=42140&view=rev
Author: brlcad
Date: 2011-01-12 15:05:39 +0000 (Wed, 12 Jan 2011)
Log Message:
-----------
strcmp() doesn't like NULL and bu_which() may produce NULL, so don't feed the
output of the latter directly into the prior. should at least avoid the
specific crash reported by tom browder to the devel mailing list, albeit
probably not the full fix needed.
Modified Paths:
--------------
brlcad/trunk/src/mged/tedit.c
Modified: brlcad/trunk/src/mged/tedit.c
===================================================================
--- brlcad/trunk/src/mged/tedit.c 2011-01-12 14:55:45 UTC (rev 42139)
+++ brlcad/trunk/src/mged/tedit.c 2011-01-12 15:05:39 UTC (rev 42140)
@@ -953,6 +953,8 @@
}
if (classic_mged) {
+ const char *which = NULL;
+
/* In this situation, make sure we're using an editor that will
* work within the mged terminal (i.e. no launching a separate
* gui, regardless of EDITOR settings. In this situation, emacs
@@ -971,17 +973,25 @@
* Hence, check for known working AND known not-working up front - need
* to satisfy both that there IS a working config already and that one
* of the non-working configs isn't set.*/
- count += (!strcmp(editor, bu_which(EMACS_EDITOR)) && (!editor_opt ||
editor_opt[0] == '\0'));
- count += !(strcmp(editor, bu_which(VIM_EDITOR)));
- count += !(strcmp(editor, bu_which(VI_EDITOR)));
- count += !(strcmp(editor, bu_which(ED_EDITOR)));
+ which = bu_which(EMACS_EDITOR);
+ if (which)
+ count += (!strcmp(editor, which) && (!editor_opt || editor_opt[0]
== '\0'));
+ which = bu_which(VIM_EDITOR);
+ if (which)
+ count += !(strcmp(editor, which));
+ which = bu_which(VI_EDITOR);
+ if (which)
+ count += !(strcmp(editor, which));
+ which = bu_which(ED_EDITOR);
+ if (which)
+ count += !(strcmp(editor, which));
count += !(strcmp(editor, JOVE_EDITOR));
count += !(!(!(strcmp(editor, MAC_EDITOR))));
if (count > 0) {
/* start with emacs... */
editor = bu_which(EMACS_EDITOR);
/* if emacs is found, set editor_opt */
- if (!strcmp(editor, bu_which(EMACS_EDITOR))) {
+ if (editor && !strcmp(editor, bu_which(EMACS_EDITOR))) {
editor_opt = "-nw";
}
if (!editor || editor[0] == '\0') {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits