mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 17:57:31 -06:00
Handle case of not having a compiler set
This commit is contained in:
+13
-8
@@ -85,17 +85,20 @@ define(function (require) {
|
||||
this.updateCompilerName();
|
||||
}
|
||||
|
||||
Compiler.prototype.compile = function (fromEditor) {
|
||||
Compiler.prototype.compile = function () {
|
||||
var self = this;
|
||||
if (!this.source || !this.compiler) return; // TODO blank out the output?
|
||||
var request = {
|
||||
fromEditor: fromEditor,
|
||||
source: this.source,
|
||||
compiler: this.compiler.id,
|
||||
source: this.source || "",
|
||||
compiler: this.compiler ? this.compiler.id : "",
|
||||
options: this.options,
|
||||
filters: this.filters.get()
|
||||
};
|
||||
|
||||
if (!this.compiler) {
|
||||
this.onCompileResponse(request, errorResult("Please select a compiler"));
|
||||
return;
|
||||
}
|
||||
|
||||
var cacheableRequest = JSON.stringify(request);
|
||||
if (cacheableRequest === this.lastRequestRespondedTo) return;
|
||||
// only set the request timestamp after checking cache; else we'll always fetch
|
||||
@@ -241,7 +244,7 @@ define(function (require) {
|
||||
|
||||
Compiler.prototype.saveState = function () {
|
||||
this.container.setState({
|
||||
compiler: this.compiler.id,
|
||||
compiler: this.compiler ? this.compiler.id : "",
|
||||
options: this.options,
|
||||
source: this.editor,
|
||||
filters: this.filters.get()
|
||||
@@ -259,8 +262,10 @@ define(function (require) {
|
||||
};
|
||||
|
||||
Compiler.prototype.updateCompilerName = function () {
|
||||
this.container.setTitle("#" + this.sourceEditorId + " with " + this.compiler.name);
|
||||
this.domRoot.find(".full-compiler-name").text(this.compiler.version);
|
||||
var compilerName = this.compiler ? this.compiler.name : "no compiler set";
|
||||
var compilerVersion = this.compiler ? this.compiler.version : "";
|
||||
this.container.setTitle("#" + this.sourceEditorId + " with " + compilerName);
|
||||
this.domRoot.find(".full-compiler-name").text(compilerVersion);
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user