summaryrefslogtreecommitdiffstats
path: root/src/inkscape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/inkscape.cpp')
-rw-r--r--src/inkscape.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index fc9a9783f..fc823f8b7 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -1270,6 +1270,10 @@ inkscape_active_document (void)
{
if (SP_ACTIVE_DESKTOP) {
return sp_desktop_document (SP_ACTIVE_DESKTOP);
+ } else if (!inkscape->document_set.empty()) {
+ // If called from the command line there will be no desktop
+ // So 'fall back' to take the first listed document in the Inkscape instance
+ return inkscape->document_set.begin()->first;
}
return NULL;