From 35327c0b5b1361e2b26f9cdf48db90ca949ea3e0 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 29 Jul 2010 00:00:37 +0000 Subject: [PATCH] I guess I like this better. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35020 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 2c53809d21..ce6da7a720 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1239,9 +1239,11 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr) } case LFUN_TEXTCLASS_APPLY: { - bool success = LayoutFileList::get().load(argument, buffer_.temppath()); - if (!success) - success = LayoutFileList::get().load(argument, buffer_.filePath()); + // since this shortcircuits, the second call is made only if + // the first fails + bool const success = + LayoutFileList::get().load(argument, buffer_.temppath()) || + LayoutFileList::get().load(argument, buffer_.filePath()); if (!success) { docstring s = bformat(_("The document class `%1$s' " "could not be loaded."), from_utf8(argument)); @@ -1269,9 +1271,11 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr) } case LFUN_TEXTCLASS_LOAD: { - bool success = LayoutFileList::get().load(argument, buffer_.temppath()); - if (!success) - success = LayoutFileList::get().load(argument, buffer_.filePath()); + // since this shortcircuits, the second call is made only if + // the first fails + bool const success = + LayoutFileList::get().load(argument, buffer_.temppath()) || + LayoutFileList::get().load(argument, buffer_.filePath()); if (!success) { docstring s = bformat(_("The document class `%1$s' " "could not be loaded."), from_utf8(argument));