Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for nil string when removing compiler command #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Check for nil string when removing compiler command #111

wants to merge 1 commit into from

Conversation

abbioro
Copy link

@abbioro abbioro commented May 31, 2017

I tried cmake-ide with a minimal project (without cmake, using bear to create compiler_commands.json and .dir-locals.el to set build and project dirs) but I kept getting an error when it tried to split a nil string in this function. I haven't bothered trying to figure out why it's being called like this but this is an easy fix to make it work properly.

Here's a backtrace if you have any ideas:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match(" +" nil 0)
  split-string(nil " +")
  cmake-ide--remove-compiler-from-args(nil)
  mapcar(cmake-ide--remove-compiler-from-args (nil))
  cmake-ide--commands-to-hdr-flags((nil))
  cmake-ide--set-flags-for-file(#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("demo.c" (((arguments . ["cc" "-c" "-g" "-o" "demo" "demo.c"]) (directory . "/home/joonatan/tmp/make_demo") (file . "demo.c"))) ...)) #<buffer demo.c>)
  #[257 "\301\300�\"\207" [#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("demo.c" (((arguments . ["cc" "-c" "-g" "-o" "demo" "demo.c"]) (directory . "/home/joonatan/tmp/make_demo") (file . "demo.c"))) ...)) cmake-ide--set-flags-for-file] 4 "\n\n(fn X)"](#<buffer demo.c>)
  mapc(#[257 "\301\300�\"\207" [#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("demo.c" (((arguments . ["cc" "-c" "-g" "-o" "demo" "demo.c"]) (directory . "/home/joonatan/tmp/make_demo") (file . "demo.c"))) ...)) cmake-ide--set-flags-for-file] 4 "\n\n(fn X)"] (#<buffer demo.c> #<killed buffer>))
  cmake-ide--on-cmake-finished()
  cmake-ide-maybe-run-cmake()
  run-hooks(find-file-hook)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer demo.c> "~/tmp/make_demo/demo.c" nil nil "~/tmp/make_demo/demo.c" (2761754 66306))
  find-file-noselect("/home/joonatan/tmp/make_demo/demo.c" nil nil nil)
  find-file("/home/joonatan/tmp/make_demo/demo.c")
  #[257 "\304\305�!!r\306\307\310\311\312�!\313\"\314$\216\315�@\316\"\210	\205��\317\n!?\205$���\320\321�\n\"!+\207" [ivy-last counsel-find-file-speedup-remote ivy--directory find-file-hook internal--before-with-selected-window ivy--get-window make-byte-code 0 "\301\300!\207" vconcat vector [internal--after-with-selected-window] 2 select-window norecord file-remote-p find-file expand-file-name] 8 "\n\n(fn X)"]("/home/joonatan/tmp/make_demo/demo.c")
  ivy-call()
  ivy-read("Find file: " read-file-name-internal :matcher counsel--find-file-matcher :initial-input nil :action #[257 "\304\305�!!r\306\307\310\311\312�!\313\"\314$\216\315�@\316\"\210	\205��\317\n!?\205$���\320\321�\n\"!+\207" [ivy-last counsel-find-file-speedup-remote ivy--directory find-file-hook internal--before-with-selected-window ivy--get-window make-byte-code 0 "\301\300!\207" vconcat vector [internal--after-with-selected-window] 2 select-window norecord file-remote-p find-file expand-file-name] 8 "\n\n(fn X)"] :preselect nil :require-match confirm-after-completion :history file-name-history :keymap (keymap (C-backspace . counsel-up-directory) (67108991 . counsel-up-directory)) :caller counsel-find-file)
  counsel-find-file()
  funcall-interactively(counsel-find-file)
  call-interactively(counsel-find-file nil nil)
  command-execute(counsel-find-file)

@atilaneves
Copy link
Owner

Please add a unit test for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants